build #2
10
Dockerfile
10
Dockerfile
@ -5,16 +5,20 @@ COPY frontend/ .
|
|||||||
RUN npm install
|
RUN npm install
|
||||||
RUN npm run build
|
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
|
FROM rust:1.83 as backend-builder
|
||||||
WORKDIR /app/backend
|
WORKDIR /app/backend
|
||||||
COPY 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
|
# Final Stage
|
||||||
FROM debian:bullseye-slim
|
FROM debian:bullseye-slim
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY --from=frontend-builder /app/frontend/build ./frontend/build
|
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
|
EXPOSE 8080
|
||||||
CMD ["./formies_be"]
|
CMD ["./formies_be"]
|
Loading…
Reference in New Issue
Block a user