2023-04-29 15:47:39 +02:00
|
|
|
FROM rust:1.69-alpine3.16 AS builder
|
2022-04-02 13:45:04 +02:00
|
|
|
|
|
|
|
ARG DI_VER=1.2.5
|
|
|
|
|
|
|
|
WORKDIR /app
|
|
|
|
|
|
|
|
RUN apk update && apk add --no-cache build-base
|
|
|
|
|
|
|
|
# Build dumb-init
|
|
|
|
RUN wget -O - "https://github.com/Yelp/dumb-init/archive/refs/tags/v${DI_VER}.tar.gz" | tar -xzf - && \
|
|
|
|
cd "dumb-init-${DI_VER}" && \
|
|
|
|
make SHELL=/bin/sh && \
|
|
|
|
mv dumb-init .. && \
|
|
|
|
cd ..
|
|
|
|
|
|
|
|
COPY . ./
|
|
|
|
|
|
|
|
RUN cargo build --release
|
|
|
|
|
|
|
|
|
2024-12-06 00:01:07 +01:00
|
|
|
FROM alpine:3.21
|
2022-04-02 13:45:04 +02:00
|
|
|
|
|
|
|
COPY --from=builder /app/target/release/site /bin/site
|
|
|
|
COPY --from=builder /app/dumb-init /bin/dumb-init
|
|
|
|
|
|
|
|
# Create a non-root user & make sure it can write to the data directory
|
|
|
|
RUN set -x && \
|
|
|
|
adduser -u 82 -D -S -G www-data www-data && \
|
|
|
|
mkdir /data && \
|
|
|
|
chown -R www-data:www-data /data
|
|
|
|
|
|
|
|
ENV DATA_DIR=/data
|
|
|
|
|
|
|
|
WORKDIR /data
|
|
|
|
|
|
|
|
USER www-data:www-data
|
|
|
|
|
|
|
|
ENTRYPOINT [ "/bin/dumb-init", "--" ]
|
|
|
|
CMD [ "/bin/site" ]
|
|
|
|
|
|
|
|
|