diff options
author | jakob.stendahl <jakob.stendahl@infomedia.dk> | 2022-01-27 11:37:46 +0100 |
---|---|---|
committer | jakob.stendahl <jakob.stendahl@infomedia.dk> | 2022-01-27 11:37:46 +0100 |
commit | 11304b3c3ad1b8e949606ee6fdff56203f4f47dc (patch) | |
tree | f860ebe23c518fec09f6f71fa98d2875b6be2b8e | |
parent | a1e0cebd1e620038ad433b2212426e6fe5d927c5 (diff) | |
download | RSS-watcher-11304b3c3ad1b8e949606ee6fdff56203f4f47dc.tar.gz RSS-watcher-11304b3c3ad1b8e949606ee6fdff56203f4f47dc.zip |
:zap: Change build-target to musl, and use scratch as base-image for final image
-rw-r--r-- | Dockerfile | 26 |
1 files changed, 18 insertions, 8 deletions
@@ -1,15 +1,25 @@ FROM rust:1.58 as builder +# Install and configure dependencies needed for building for musl target +RUN rustup target add x86_64-unknown-linux-musl +RUN apt update && apt install -y musl-tools musl-dev +RUN update-ca-certificates + +# Add source code to image WORKDIR /usr/src/rss-watcher COPY . . -RUN cargo install --path . +# Build +RUN cargo build --target x86_64-unknown-linux-musl --release + +# Move to a smaller image +FROM scratch + +# Copy binary from builder +COPY --from=builder /usr/src/rss-watcher/target/x86_64-unknown-linux-musl/release/rss-watcher /rss-watcher -#FROM debian:buster-slim -#RUN apt-get update \ -# && apt-get install -y libssl-dev libc-bin libc6 \ -# && rm -rf /var/lib/apt/lists/* -#COPY --from=builder /usr/local/cargo/bin/rss-watcher /usr/local/bin/rss-watcher -#ENV RUST_LOG=info +# Add log level info, if we don't do this, no logs will be written +ENV RUST_LOG=info -CMD ["rss-watcher"] +# Start target +CMD ["/rss-watcher"] |