From 12bf65f8650be919629622658f1bfcd3e8dc181f Mon Sep 17 00:00:00 2001 From: Mohamad Date: Fri, 3 Jan 2025 13:52:48 +0100 Subject: [PATCH] lol --- Dockerfile | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index e23bc43..c0eaf2a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,16 +5,20 @@ COPY frontend/ . RUN npm install RUN npm run build -# Stage 2: Build the Rust backend +# Stage 2: Build the Rust backend (statically linked) FROM rust:1.83 as backend-builder WORKDIR /app/backend COPY backend/ . -RUN cargo build --release +# Add the musl target for static linking +RUN rustup target add x86_64-unknown-linux-musl +# Build the binary with musl +RUN cargo build --release --target x86_64-unknown-linux-musl # Final Stage FROM debian:bullseye-slim WORKDIR /app COPY --from=frontend-builder /app/frontend/build ./frontend/build -COPY --from=backend-builder /app/backend/target/release/formies_be ./formies_be +# Copy the statically linked binary +COPY --from=backend-builder /app/backend/target/x86_64-unknown-linux-musl/release/formies_be ./formies_be EXPOSE 8080 CMD ["./formies_be"] \ No newline at end of file