2026-09-10 19:14:21 +04:00
|
|
|
# syntax=docker/dockerfile:1
|
2026-09-10 19:34:49 +04:00
|
|
|
FROM rust:1.98.1-alpine3.22 AS build
|
|
|
|
|
RUN apk add --no-cache cmake make
|
2026-09-10 19:14:21 +04:00
|
|
|
WORKDIR /build
|
2026-09-10 19:34:49 +04:00
|
|
|
ARG TARGETARCH
|
|
|
|
|
ARG CARGO_BUILD_JOBS=2
|
2026-09-10 19:14:21 +04:00
|
|
|
COPY Cargo.toml Cargo.lock rust-toolchain.toml ./
|
2026-09-10 19:34:49 +04:00
|
|
|
RUN rustup show active-toolchain
|
2026-09-10 19:14:21 +04:00
|
|
|
COPY src ./src
|
2026-09-10 19:34:49 +04:00
|
|
|
RUN --mount=type=cache,id=vacationplanner2ics-registry,target=/usr/local/cargo/registry,sharing=locked \
|
|
|
|
|
--mount=type=cache,id=vacationplanner2ics-target-${TARGETARCH},target=/build/target,sharing=locked \
|
|
|
|
|
cargo fmt --check && \
|
|
|
|
|
cargo clippy --release --locked --all-targets -- -D warnings && \
|
2026-09-10 19:14:21 +04:00
|
|
|
cargo build --release --locked && \
|
2026-09-10 19:34:49 +04:00
|
|
|
! readelf -l target/release/vacationplanner2ics | grep -q INTERP && \
|
2026-09-10 19:14:21 +04:00
|
|
|
cp target/release/vacationplanner2ics /usr/local/bin/vacationplanner2ics
|
|
|
|
|
|
2026-09-10 19:34:49 +04:00
|
|
|
FROM python:3.14-alpine3.22 AS test
|
|
|
|
|
COPY tests/requirements.txt /tests/requirements.txt
|
|
|
|
|
RUN pip install --no-cache-dir -r /tests/requirements.txt
|
2026-09-10 19:14:21 +04:00
|
|
|
COPY --from=build /usr/local/bin/vacationplanner2ics /usr/local/bin/
|
|
|
|
|
COPY tests /tests
|
|
|
|
|
ENV PYTHONDONTWRITEBYTECODE=1
|
|
|
|
|
USER 65532:65532
|
|
|
|
|
CMD ["python", "/tests/e2e.py"]
|
|
|
|
|
|
2026-09-10 19:34:49 +04:00
|
|
|
FROM scratch AS runtime
|
|
|
|
|
COPY --from=build /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
|
|
|
|
|
COPY --from=build /usr/local/bin/vacationplanner2ics /vacationplanner2ics
|
|
|
|
|
LABEL org.opencontainers.image.source="https://code.popov.link/valentineus/vacationplanner2ics" \
|
|
|
|
|
org.opencontainers.image.description="Vacationplanner calendar subscriptions over HTTP" \
|
|
|
|
|
org.opencontainers.image.licenses="MIT"
|
2026-09-10 19:14:21 +04:00
|
|
|
USER 65532:65532
|
|
|
|
|
EXPOSE 8080
|
2026-09-10 19:34:49 +04:00
|
|
|
ENTRYPOINT ["/vacationplanner2ics"]
|