yagcdn/Dockerfile

30 lines
784 B
Docker
Raw Normal View History

2019-07-24 17:54:54 +02:00
FROM ekidd/rust-musl-builder:stable as builder
# create new cargo project
RUN USER=rust cargo init --bin
# copy build config
COPY --chown=rust ./Cargo.lock ./Cargo.lock
COPY --chown=rust ./Cargo.toml ./Cargo.toml
# build to cache dependencies
RUN cargo build --release
# delete build cache to prevent caching issues later on
RUN rm -r ./target/x86_64-unknown-linux-musl/release/.fingerprint/gitache-*
COPY ./src ./src
# build source code
RUN cargo build --release
2019-07-24 18:05:11 +02:00
# create /etc/password for rootless scratch container
FROM alpine:latest as user_builder
RUN USER=root adduser -D -u 10001 dummy
2019-07-24 17:54:54 +02:00
FROM scratch
2019-07-24 18:05:11 +02:00
COPY --from=user_builder /etc/passwd /etc/passwd
2019-07-24 17:54:54 +02:00
USER dummy
COPY --from=builder /home/rust/src/target/x86_64-unknown-linux-musl/release/gitache /
ENTRYPOINT ["/gitache"]