42 lines
1.1 KiB
Docker
42 lines
1.1 KiB
Docker
# syntax=docker/dockerfile:1
|
|
|
|
FROM rust:1.89-bookworm AS builder
|
|
|
|
WORKDIR /app
|
|
|
|
COPY Cargo.toml Cargo.lock ./
|
|
COPY src ./src
|
|
COPY migrations ./migrations
|
|
COPY static ./static
|
|
COPY templates ./templates
|
|
|
|
RUN cargo build --release
|
|
|
|
FROM debian:bookworm-slim
|
|
|
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
ca-certificates \
|
|
curl \
|
|
sqlite3 \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
RUN groupadd -r app && useradd -r -g app app
|
|
|
|
WORKDIR /app
|
|
|
|
RUN mkdir -p /app/data /app/exports /app/backups && \
|
|
chown -R app:app /app
|
|
|
|
COPY --from=builder /app/target/release/sub-aligator /usr/local/bin/sub-aligator
|
|
COPY --from=builder /app/migrations /app/migrations
|
|
COPY --from=builder /app/static /app/static
|
|
COPY --from=builder /app/templates /app/templates
|
|
COPY docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh
|
|
RUN chmod +x /usr/local/bin/docker-entrypoint.sh
|
|
|
|
EXPOSE 8080
|
|
|
|
HEALTHCHECK --interval=30s --timeout=5s --start-period=5s --retries=3 \
|
|
CMD curl -fsS http://localhost:8080/healthz >/dev/null || exit 1
|
|
|
|
ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"]
|