Fix Dockerfile

main
DaXcess 2024-08-21 11:57:27 +02:00
parent eefe2561f2
commit 3394d495fe
No known key found for this signature in database
GPG Key ID: CF78CC72F0FD5EAD
1 changed files with 6 additions and 5 deletions

View File

@ -14,12 +14,13 @@ WORKDIR /app
# Add extra build dependencies here
RUN apt-get update && apt install -yqq \
cmake gcc-aarch64-linux-gnu binutils-aarch64-linux-gnu libpq-dev
cmake gcc-aarch64-linux-gnu binutils-aarch64-linux-gnu libpq-dev curl bzip2
# Manually compile an arm64 build of libpq
RUN wget https://ftp.postgresql.org/pub/source/v16.4/postgresql-16.4.tar.bz2 && \
tar xjf postgresql-16.4.tar.bz2 && \
cd postgresql-16.4 && \
ENV PGVER=16.4
RUN curl -o postgresql.tar.bz2 https://ftp.postgresql.org/pub/source/v${PGVER}/postgresql-${PGVER}.tar.bz2 && \
tar xjf postgresql.tar.bz2 && \
cd postgresql-${PGVER} && \
./configure --host=aarch64-linux-gnu --enable-shared --disable-static --without-readline --without-zlib --without-icu && \
cd src/interfaces/libpq && \
make
@ -32,7 +33,7 @@ RUN rustup target add x86_64-unknown-linux-gnu aarch64-unknown-linux-gnu
RUN --mount=type=cache,target=/usr/local/cargo/registry \
--mount=type=cache,target=/app/target \
cargo build --release --target=x86_64-unknown-linux-gnu && \
RUSTFLAGS='-L /app/postgresql-16.4/src/interfaces/libpq -C linker=aarch64-linux-gnu-gcc' cargo build --release --target=aarch64-unknown-linux-gnu && \
RUSTFLAGS="-L /app/postgresql-${PGVER}/src/interfaces/libpq -C linker=aarch64-linux-gnu-gcc" cargo build --release --target=aarch64-unknown-linux-gnu && \
# Copy the executables outside of /target as it'll get unmounted after this RUN command
cp /app/target/x86_64-unknown-linux-gnu/release/spoticord /app/x86_64 && \
cp /app/target/aarch64-unknown-linux-gnu/release/spoticord /app/aarch64