This commit is contained in:
parent
5eb085067d
commit
12bf65f865
10
Dockerfile
10
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"]
|
Loading…
Reference in New Issue
Block a user