fej/docker/Dockerfile.rel

34 lines
1010 B
Docker
Raw Normal View History

2021-04-17 13:46:38 +02:00
# vim: filetype=dockerfile
FROM chewingbever/fej-builder:latest AS builder
# And then finally, build the project
# Thank the lords that this article exists
# https://users.rust-lang.org/t/sigsegv-with-program-linked-against-openssl-in-an-alpine-container/52172
# TODO add what these flags do & why they work
# NOTE: cargo install auto-appends bin to the path
RUN --mount=type=cache,target=/usr/src/app/target \
--mount=type=cache,target=/root/.cargo/registry \
cargo install \
--path . \
--root /usr/local \
--target x86_64-unknown-linux-musl
# Now, we create the actual image
FROM alpine:latest
# Install some dynamic libraries needed for everything to work
2021-04-12 22:55:52 +02:00
RUN apk update && apk add --no-cache openssl libgcc curl
# Copy binary over to final image
COPY --from=builder /usr/local/bin/server /usr/local/bin/server
2021-04-12 22:55:52 +02:00
HEALTHCHECK \
--interval=10s \
--timeout=5s \
--start-period=1s \
--retries=3 \
CMD curl -q localhost:8000
CMD ["/usr/local/bin/server"]