-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
42 lines (29 loc) · 1.01 KB
/
Dockerfile
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
FROM rust:latest AS build
# Ensure ca-certificates are up to date
RUN update-ca-certificates
# Set the current Working Directory inside the container
RUN mkdir /scratch
WORKDIR /scratch
RUN mkdir /dora-storage
# Copy everything from the current directory to the PWD(Present Working Directory) inside the container
COPY . dora-storage/.
WORKDIR /scratch/dora-storage
RUN cargo build --release
WORKDIR /scratch
RUN mkdir /app
RUN mkdir /data
RUN mv dora-storage/target/release/dora-storage /app
############################
# Image
############################
# https://console.cloud.google.com/gcr/images/distroless/global/cc-debian11
# using distroless cc "nonroot" image, which includes everything in the base image (glibc, libssl and openssl)
FROM gcr.io/distroless/cc-debian11:nonroot
EXPOSE 9000
EXPOSE 8000
# Copy the app dir into distroless image
COPY --chown=nonroot:nonroot --from=build /app /app
COPY --chown=nonroot:nonroot --from=build /data /data
WORKDIR /app
USER nonroot
ENTRYPOINT ["/app/dora-storage"]