/ Earthfile
Earthfile
1 # Builder image with development dependencies. 2 VERSION 0.8 3 FROM ghcr.io/void-linux/void-linux:latest-mini-x86_64 4 5 WORKDIR /root/src 6 7 init: 8 RUN xbps-install -S 9 RUN xbps-install -yu xbps 10 RUN xbps-install -Syu 11 RUN xbps-install -Sy base-devel rustup cmake wget gnupg 12 RUN xbps-install -Sy openssl-devel libstdc++-devel 13 RUN rustup-init -qy 14 15 build: 16 FROM +init 17 # Install tini for signal processing and zombie killing 18 ENV TINI_VERSION v0.19.0 19 RUN curl -s -o /usr/local/bin/tini https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini 20 RUN chmod +x /usr/local/bin/tini 21 22 # Build dicebot 23 RUN mkdir -p /root/src 24 WORKDIR /root/src 25 COPY . ./ 26 RUN . /root/.cargo/env && cargo build --release 27 SAVE ARTIFACT /root/src/target/release/dicebot 28 29 # Final image 30 docker: 31 RUN xbps-install -S 32 RUN xbps-install -yu xbps 33 RUN xbps-install -Syu 34 RUN xbps-install -Sy ca-certificates libstdc++ 35 COPY --from=builder \ 36 /root/src/target/release/dicebot \ 37 /usr/local/bin/ 38 COPY --from=builder \ 39 /usr/local/bin/tini \ 40 /usr/local/bin/ 41 42 ENV XDG_CACHE_HOME "/cache" 43 ENV DATABASE_PATH "/cache/bot-db" 44 ENTRYPOINT [ "/usr/local/bin/tini", "-v", "--", "/usr/local/bin/dicebot", "/config/dicebot-config.toml" ]