diff options
-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"] |