2021-04-12 17:39:52 +02:00
|
|
|
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 \
|
2021-04-15 19:26:37 +02:00
|
|
|
cargo install --path . --root /usr/local
|
2021-04-12 17:39:52 +02:00
|
|
|
|
|
|
|
|
|
|
|
# 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
|
2021-04-12 17:39:52 +02:00
|
|
|
|
|
|
|
# Copy binary over to final image
|
2021-04-15 19:26:37 +02:00
|
|
|
COPY --from=builder /usr/local/bin/server /usr/local/bin/server
|
2021-04-12 17:39:52 +02:00
|
|
|
|
2021-04-12 22:55:52 +02:00
|
|
|
HEALTHCHECK \
|
|
|
|
--interval=10s \
|
|
|
|
--timeout=5s \
|
|
|
|
--start-period=1s \
|
|
|
|
--retries=3 \
|
|
|
|
CMD curl -q localhost:8000
|
|
|
|
|
2021-04-15 19:26:37 +02:00
|
|
|
CMD ["/usr/local/bin/server"]
|