-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathDockerfile
37 lines (25 loc) · 844 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
FROM alpine:latest AS builder
WORKDIR /app
RUN apk update
RUN apk upgrade
RUN apk add curl libgcc gcc libc-dev
RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain stable --profile minimal
# load and pre-compile the cargo crates
COPY Cargo.toml .
COPY Cargo.lock .
RUN mkdir src && \
echo "fn main(){}" > src/main.rs
RUN source $HOME/.cargo/env && cargo build --release --target x86_64-unknown-linux-musl
# Copy in the source code
COPY src ./src/
# Make sure the correct src/main.rs is newer
RUN touch src/main.rs
RUN source $HOME/.cargo/env && cargo build --release --target x86_64-unknown-linux-musl
FROM alpine:latest
WORKDIR /app
RUN apk update
RUN apk upgrade
RUN apk add ca-certificates
COPY config.json .
COPY --from=builder /app/target/x86_64-unknown-linux-musl/release/trangarbot .
CMD ["./trangarbot"]