-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
33 lines (24 loc) · 856 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
FROM rust:1.78 as build
# install https://lib.rs/crates/cargo-build-dependencies so we can cache dependencies in a seperate layer
RUN cargo install cargo-build-dependencies
# Create a new empty shell project
RUN USER=root cargo new --bin dsa-cli
WORKDIR /dsa-cli
COPY Cargo.toml Cargo.lock ./
# Build and cache dependencies
RUN cargo build-dependencies --release
# Build application
COPY ./src ./src
COPY build.rs ./
COPY ./.git ./.git
# Extract git head if .git folder exists
RUN $([ -d /.git ] && echo $(git rev-parse --short HEAD) > HEAD && rm -r .git && mkdir .git && mv HEAD .git/HEAD) || true
RUN cargo build --release
#Final base
FROM debian:stable
#Copy executable
COPY --from=build /dsa-cli/target/release/dsa-cli .
#Change the config location
ENV DSA_CLI_CONFIG_DIR=/dsa-cli-config
#Set the startup command
CMD ["./dsa-cli", "discord"]