Add Dockerfile and Docker Hub publishing (#9)

Adds docker image publishing with example usage in the README.
This commit is contained in:
Dave Gallant
2020-07-11 22:47:30 -04:00
committed by GitHub
parent 8af371626f
commit d3a23736cc
10 changed files with 99 additions and 251 deletions

34
Dockerfile Normal file
View File

@@ -0,0 +1,34 @@
FROM rust@sha256:b2fd2fcc9d28c1a6dc59c3b0b37913fd9a326c8e457e50617e1156fc1ad51e34 as build
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && \
apt-get -y install \
ca-certificates \
libssl-dev \
musl-tools
RUN rustup target add x86_64-unknown-linux-musl
WORKDIR /usr/src/rfd-notify
COPY Cargo.toml Cargo.toml
COPY src src
ENV PKG_CONFIG_ALLOW_CROSS=1
RUN RUSTFLAGS=-Clinker=musl-gcc cargo build --release --target=x86_64-unknown-linux-musl
RUN mkdir /examples
COPY examples /examples
FROM scratch
COPY --from=build /examples /examples
COPY --from=build /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
COPY --from=build /usr/src/rfd-notify/target/x86_64-unknown-linux-musl/release/rfd-notify .
ENV SSL_CERT_FILE=/etc/ssl/certs/ca-certificates.crt
ENV SSL_CERT_DIR=/etc/ssl/certs
ENTRYPOINT ["/rfd-notify"]