-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile
40 lines (25 loc) · 899 Bytes
/
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
FROM python:3.9.6-alpine as builder
ENV \
PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1 \
PYTHONFAULTHANDLER=1
# RUN pip config set global.index-url https://mirrors.cloud.tencent.com/pypi/simple/
ARG POETRY_VERSION=1.4.0
RUN pip install poetry==${POETRY_VERSION}
# RUN --mount=type=cache,target=/root/.cache/pip pip install poetry
WORKDIR /app
COPY pyproject.toml poetry.lock ./
RUN --mount=type=cache,target=/root/.cache/pypoetry \
poetry config virtualenvs.in-project true && \
poetry install --no-dev --no-ansi --no-interaction --no-root
# -------
FROM python:3.9.6-alpine as prd
ENV FLASK_ENV=production
ENV FLASK_DEBUG=False
RUN addgroup -S rssman && adduser -S rssman -G rssman
WORKDIR /app
COPY --from=builder --chown=rssman:rssman /app/.venv /app/.venv
COPY --chown=rssman:rssman . .
ENV PATH="/app/.venv/bin:$PATH"
EXPOSE 6000
CMD ["python", "./app.py"]