New Dockerfile to work with glibc.

This commit is contained in:
jeff 2020-08-27 01:22:40 +00:00 committed by projectmoon
parent 0eb181a7a9
commit f3de145663
2 changed files with 34 additions and 10 deletions

View File

@ -1 +1,2 @@
target/ target/
.git

View File

@ -1,12 +1,35 @@
# Yoinked from: # Builder image
# https://github.com/emk/rust-musl-builder/blob/master/examples/using-diesel/Dockerfile FROM bougyman/voidlinux:glibc as builder
FROM ekidd/rust-musl-builder:stable AS builder RUN xbps-install -Sy base-devel libressl-devel wget gnupg rustup
ADD --chown=rust:rust . ./ RUN rustup-init -qy
RUN cargo build --release
FROM alpine:latest # Install tini for signal processing and zombie killing
RUN apk --no-cache add ca-certificates ENV TINI_VERSION v0.18.0
ENV TINI_SIGN_KEY 595E85A6B1B4779EA4DAAEC70B588DFF0527A9B7
RUN set -eux; \
wget -O /usr/local/bin/tini "https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini"; \
wget -O /usr/local/bin/tini.asc "https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini.asc"; \
export GNUPGHOME="$(mktemp -d)"; \
gpg --batch --keyserver ha.pool.sks-keyservers.net --recv-keys "$TINI_SIGN_KEY"; \
gpg --batch --verify /usr/local/bin/tini.asc /usr/local/bin/tini; \
command -v gpgconf && gpgconf --kill all || :; \
rm -r "$GNUPGHOME" /usr/local/bin/tini.asc; \
chmod +x /usr/local/bin/tini; \
tini --version
# Build dicebot
RUN mkdir -p /root/src
WORKDIR /root/src
ADD . ./
RUN . /root/.cargo/env && cargo build --release
# Final image
FROM bougyman/voidlinux:latest
RUN xbps-install -Sy ca-certificates libstdc++ libressl
COPY --from=builder \ COPY --from=builder \
/home/rust/src/target/x86_64-unknown-linux-musl/release/dicebot \ /root/src/target/release/dicebot \
/usr/local/bin/ /usr/local/bin/
CMD /usr/local/bin/dicebot /config/dicebot-config.toml COPY --from=builder \
/usr/local/bin/tini \
/usr/local/bin/
ENTRYPOINT [ "/usr/local/bin/tini", "-v", "--", "/usr/local/bin/dicebot", "/config/dicebot-config.toml" ]