-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
59 lines (39 loc) · 1.41 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
54
55
56
57
58
59
ARG PYTHON_VERSION=3.12.4
FROM python:${PYTHON_VERSION}-slim AS python-base
ARG UID=1001
ARG VERSION
ARG REVISION=""
LABEL org.opencontainers.image.title="ridiwise" \
org.opencontainers.image.version="${VERSION}" \
org.opencontainers.image.url="https://github.com/bskim45/ridiwise" \
org.opencontainers.image.source="https://github.com/bskim45/ridiwise" \
org.opencontainers.image.authors="Bumsoo Kim <[email protected]>"
ENV PIP_NO_CACHE_DIR=off \
PIP_DISABLE_PIP_VERSION_CHECK=on \
PIP_DEFAULT_TIMEOUT=100 \
VENV_PATH=/opt/venv \
PYTHONUNBUFFERED=1 \
PYTHONDONTWRITEBYTECODE=1
ENV PATH="$VENV_PATH/bin:$PATH"
ENV PLAYWRIGHT_BROWSERS_PATH=/ms-playwright
RUN useradd -m -u 1001 noroot
FROM python-base AS build-venv
WORKDIR /build
RUN python -m venv $VENV_PATH
# Install python dependencies
COPY pyproject.toml requirements.lock /build/
COPY LICENSE README.md /build/
COPY src/ridiwise/__init__.py /build/src/ridiwise/__init__.py
RUN pip install --no-cache-dir -r requirements.lock
FROM python-base AS build-playwright
# Install playwright with system dependencies
COPY --from=build-venv $VENV_PATH $VENV_PATH
RUN playwright install --with-deps chromium \
&& rm -rf /var/lib/apt/lists/*
FROM build-playwright AS runtime
WORKDIR /app
COPY src .
USER noroot
ENV RIDIWISE_CONFIG_DIR=/app/.config/ridiwise
ENV RIDIWISE_CACHE_DIR=/app/.cache/ridiwise
ENTRYPOINT ["python", "-m", "ridiwise"]