2020-09-25 22:31:06 +00:00
|
|
|
# Builder image with development dependencies.
|
2020-08-27 01:22:40 +00:00
|
|
|
FROM bougyman/voidlinux:glibc as builder
|
2020-09-25 22:31:06 +00:00
|
|
|
RUN xbps-install -Sy base-devel rust cargo cmake wget gnupg
|
|
|
|
RUN xbps-install -Sy libressl-devel olm-devel libstdc++-devel
|
|
|
|
#RUN rustup-init -qy
|
2020-08-23 20:59:09 +00:00
|
|
|
|
2020-08-27 01:22:40 +00:00
|
|
|
# Install tini for signal processing and zombie killing
|
|
|
|
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
|
2020-09-25 22:31:06 +00:00
|
|
|
# OLM is temporarily built with dynamic linking due to a bug in
|
|
|
|
# olm-sys: https://gitlab.gnome.org/BrainBlasted/olm-sys/-/issues/6
|
2020-08-27 01:22:40 +00:00
|
|
|
RUN mkdir -p /root/src
|
|
|
|
WORKDIR /root/src
|
|
|
|
ADD . ./
|
2020-09-25 22:31:06 +00:00
|
|
|
RUN OLM_LINK_VARIANT=dylib cargo build --release
|
2020-08-27 01:22:40 +00:00
|
|
|
|
|
|
|
# Final image
|
|
|
|
FROM bougyman/voidlinux:latest
|
2020-09-25 22:31:06 +00:00
|
|
|
RUN xbps-install -Sy ca-certificates libstdc++ olm
|
2020-08-27 01:22:40 +00:00
|
|
|
COPY --from=builder \
|
|
|
|
/root/src/target/release/dicebot \
|
|
|
|
/usr/local/bin/
|
2020-08-23 20:59:09 +00:00
|
|
|
COPY --from=builder \
|
2020-08-27 01:22:40 +00:00
|
|
|
/usr/local/bin/tini \
|
2020-08-23 20:59:09 +00:00
|
|
|
/usr/local/bin/
|
2020-08-27 19:44:16 +00:00
|
|
|
|
|
|
|
ENV XDG_CACHE_HOME "/cache"
|
2020-08-27 01:22:40 +00:00
|
|
|
ENTRYPOINT [ "/usr/local/bin/tini", "-v", "--", "/usr/local/bin/dicebot", "/config/dicebot-config.toml" ]
|