-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbackend.Dockerfile
More file actions
27 lines (23 loc) · 804 Bytes
/
backend.Dockerfile
File metadata and controls
27 lines (23 loc) · 804 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
FROM rust:1.81 as build
ENV PKG_CONFIG_ALLOW_CROSS=1
WORKDIR /usr/src/backend-service
COPY Cargo.* .
# Dummy packages
RUN cargo new backend && cargo new frontend && cargo new common
# Only build dependencies
COPY backend/Cargo.* backend/
COPY common/Cargo.* common/
RUN cargo build
RUN cargo build --release
RUN rm -rf backend common
# Now add own source code
COPY common/ common/
COPY backend/src backend/src
COPY backend/Cargo.* backend/
WORKDIR /usr/src/backend-service/backend
EXPOSE 20103
RUN cargo build --bin redteam-demo-backend --release
# Production image only running the final application
FROM gcr.io/distroless/cc-debian12 as run
COPY --from=build /usr/src/backend-service/target/release/redteam-demo-backend /target-binary/bin/backend-service
CMD ["/target-binary/bin/backend-service"]