You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

28 lines
714 B

# -*- mode: dockerfile -*-
ARG BASE_IMAGE=ekidd/rust-musl-builder:latest
# Our first FROM statement declares the build environment.
# Cache our dependencies
WORKDIR /home/rust/
RUN USER=rust cargo new xkcd --bin
WORKDIR /home/rust/xkcd
COPY Cargo.* ./
RUN cargo build --release && rm ./target/x86_64-unknown-linux-musl/release/deps/xkcd* && rm -rf ./src/
# Add our source code.
COPY . ./
# Fix permissions on source code.
RUN sudo chown -R rust:rust /home/rust
# Build our application.
RUN cargo build --release
# Runner
FROM alpine:latest
RUN apk --no-cache add ca-certificates
COPY --from=builder /home/rust/xkcd/target/x86_64-unknown-linux-musl/release/xkcd /xkcd
CMD /xkcd