rewrite dockerfile / deployment
This commit is contained in:
17
Dockerfile
17
Dockerfile
@@ -1,10 +1,21 @@
|
||||
FROM rust:1.43 as builder
|
||||
FROM rust:1.47 as builder
|
||||
|
||||
WORKDIR /usr/src/sarcastifybot
|
||||
|
||||
# Avoid having to install/build all dependencies by copying
|
||||
# the Cargo files and making a dummy src/main.rs
|
||||
COPY Cargo.toml .
|
||||
COPY Cargo.lock .
|
||||
RUN mkdir -p src && echo "fn main() {}" > src/main.rs
|
||||
RUN cargo build --release
|
||||
|
||||
# We need to touch our real main.rs file or else docker will use
|
||||
# the cached one.
|
||||
COPY . .
|
||||
RUN cargo install --path .
|
||||
RUN touch src/main.rs
|
||||
RUN cargo build --release
|
||||
|
||||
FROM debian:buster
|
||||
RUN apt-get update && apt-get install -y openssl ca-certificates
|
||||
COPY --from=builder /usr/local/cargo/bin/sarcastifybot /usr/local/bin/sarcastifybot
|
||||
COPY --from=builder /usr/src/sarcastifybot/target/release/sarcastifybot /usr/local/bin/sarcastifybot
|
||||
CMD ["sarcastifybot"]
|
||||
|
||||
Reference in New Issue
Block a user