forked from monosans/proxy-scraper-checker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
53 lines (35 loc) · 1.43 KB
/
Dockerfile
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
# syntax=docker/dockerfile:1
FROM docker.io/python:3.12-slim-bookworm AS python-base-stage
ENV \
PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1
WORKDIR /app
FROM python-base-stage AS python-build-stage
RUN apt-get update \
&& apt-get install -y --no-install-recommends build-essential \
&& apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false \
&& rm -rf /var/lib/apt/lists/*
ENV \
UV_COMPILE_BYTECODE=1 \
UV_LINK_MODE=copy
RUN --mount=from=ghcr.io/astral-sh/uv,source=/uv,target=/bin/uv \
--mount=type=cache,target=/root/.cache/uv,sharing=locked \
--mount=source=pyproject.toml,target=pyproject.toml \
--mount=source=uv.lock,target=uv.lock \
uv sync --extra non-termux --no-dev --no-install-project --frozen
FROM python-base-stage AS python-run-stage
RUN apt-get update \
&& apt-get install -y --no-install-recommends tini \
&& apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false \
&& rm -rf /var/lib/apt/lists/* \
&& groupadd --gid 1000 app \
&& useradd --gid 1000 --no-log-init --create-home --uid 1000 app \
&& mkdir -p /home/app/.cache/proxy_scraper_checker \
&& chown 1000:1000 /home/app/.cache/proxy_scraper_checker
COPY --from=python-build-stage --chown=1000:1000 --link /app/.venv /app/.venv
ENV PATH="/app/.venv/bin:$PATH"
ENV IS_DOCKER=1
USER app
COPY --chown=1000:1000 . .
ENTRYPOINT ["tini", "--"]
CMD ["python", "-m", "proxy_scraper_checker"]