-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathContainerfile
44 lines (33 loc) · 1.38 KB
/
Containerfile
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
43
44
# # # # # # # # # # # # # # # # # # # #
# Builder
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
FROM docker.io/alpine as builder
# Create an empty directory that will be used in the final image
RUN mkdir "/empty_dir"
# Install required packages for the staging script
RUN apk update && apk add --no-cache bash file
# Copy all archs into this container
RUN mkdir /work
WORKDIR /work
COPY target .
COPY .container/stage-arch-bin.sh /work
# This will copy the cpu arch corresponding binary to /target/this-week-in-past
RUN bash stage-arch-bin.sh this-week-in-past
# # # # # # # # # # # # # # # # # # # #
# Run image
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
FROM scratch
ENV USER "1337"
ENV RESOURCE_PATHS "/resources"
ENV DATA_FOLDER "/data"
ENV RUST_LOG "info"
# For performance reasons write data to docker volume instead of containers writeable fs layer
VOLUME $DATA_FOLDER
# Copy the empty directory as data and temp folder
COPY --chown=$USER:$USER --from=builder /empty_dir $DATA_FOLDER
COPY --chown=$USER:$USER --from=builder /empty_dir /tmp
# Copy the built application from the build image to the run-image
COPY --chown=$USER:$USER --from=builder /work/this-week-in-past /this-week-in-past
EXPOSE 8080
USER $USER
ENTRYPOINT ["/this-week-in-past"]