-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
39 lines (28 loc) · 960 Bytes
/
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
# Build stage
FROM rust:latest AS build
# Create a new empty shell project to cache depenency builds
RUN USER=root cargo new moon-phases
WORKDIR /moon-phases
# Copy over your manifests
COPY ./Cargo.lock ./Cargo.lock
COPY ./Cargo.toml ./Cargo.toml
# Build this project, this will pull in all the dependencies and compile them
RUN cargo build --release
# Remove the auto-generated "Hello, world!" source code
RUN rm src/*.rs
# Copy the source code files
COPY ./src ./src
# Build the application
RUN cargo build --release
# Runtime stage
FROM ubuntu:latest
# Install SSL certificates
RUN apt-get update \
&& apt-get install -y ca-certificates tzdata \
&& rm -rf /var/lib/apt/lists/*
COPY ./static ./static
COPY --from=build /moon-phases/target/release/moon-phases /usr/local/bin
COPY --from=build /moon-phases/target/release/build-css /usr/local/bin
# Set the startup command
CMD ["/usr/local/bin/build-css"]
CMD ["/usr/local/bin/moon-phases"]