Repository navigation
Expand file tree
/
Copy pathDockerfile
More file actions
59 lines (45 loc) · 2.1 KB
/
Copy pathDockerfile
File metadata and controls
59 lines (45 loc) · 2.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
FROM python:3.15-slim AS builder
WORKDIR /app
COPY --from=ghcr.io/astral-sh/uv /uv /uvx /bin/
# Install dependencies
COPY pyproject.toml uv.lock .
RUN --mount=type=cache,target=/root/.cache/uv \
uv sync --locked --no-default-groups --no-install-project
# Install project
COPY README.md COPYING .
COPY safeway_coupons/ ./safeway_coupons/
ARG UV_DYNAMIC_VERSIONING_BYPASS=0.0.0
RUN uv sync --locked --no-default-groups --no-editable
# Condition build cache on Chrome version via packages index
FROM scratch AS chrome-version-cache
ARG TARGETARCH
ADD https://dl.google.com/linux/chrome/deb/dists/stable/main/binary-${TARGETARCH}/Packages /chrome-packages
FROM python:3.15-slim
WORKDIR /app
LABEL org.opencontainers.image.licenses="GPL-3.0-or-later"
RUN --mount=type=bind,from=chrome-version-cache,target=/tmp/chrome-version-cache \
apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends ca-certificates wget && \
wget -q -O /usr/share/keyrings/chrome.pub https://dl-ssl.google.com/linux/linux_signing_key.pub && \
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/chrome.pub] http://dl.google.com/linux/chrome/deb/ stable main" \
> /etc/apt/sources.list.d/google-chrome.list && \
apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -y google-chrome-stable tini && \
rm -rf /var/lib/apt/lists/*
# Install busybox utilities using static binary from official image
COPY --from=busybox /bin/busybox /bin/busybox
RUN for target in /usr/sbin/sendmail /usr/sbin/crond /usr/bin/crontab; do \
ln -svf /bin/busybox ${target}; \
done
COPY --from=builder /app/.venv /app/.venv
ENV PATH="/app/.venv/bin:$PATH"
ENV PYTHONUNBUFFERED=1
ARG NO_BROWSER_TEST=
RUN --mount=type=tmpfs,target=/tmp \
--mount=type=tmpfs,target=/var/cache/fontconfig \
[ -n "${NO_BROWSER_TEST-}" ] || HOME=/tmp PYTHONDONTWRITEBYTECODE=1 safeway-coupons browser test;
COPY docker /opt/docker
ENV SAFEWAY_COUPONS_STORAGE_DIR=/storage
ENV CRON_SCHEDULE="5 2 * * *"
ENTRYPOINT ["/usr/bin/tini", "-s", "--", "/opt/docker/entrypoint"]
CMD ["service"]