forked from mozilla/jira-bugzilla-integration
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
44 lines (35 loc) · 1.19 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
# Creating a python base with shared environment variables
FROM python:3.10.7 as base
ENV PIP_NO_CACHE_DIR=off \
PIP_DEFAULT_TIMEOUT=100 \
PIP_DISABLE_PIP_VERSION_CHECK=on \
POETRY_HOME="/opt/poetry" \
POETRY_NO_INTERACTION=1 \
POETRY_VIRTUALENVS_IN_PROJECT=true \
PYSETUP_PATH="/opt/pysetup"
ENV PATH="$POETRY_HOME/bin:$PATH"
# Install Poetry - respects $POETRY_VERSION & $POETRY_HOME
ENV POETRY_VERSION=1.1.14
RUN curl -sSL https://install.python-poetry.org | python3 -
# We copy our Python requirements here to cache them
# and install only runtime deps using poetry
WORKDIR $PYSETUP_PATH
COPY ./poetry.lock ./pyproject.toml ./
RUN poetry install --no-dev --no-root
# `production` stage uses the dependencies downloaded in the `base` stage
FROM python:3.10.7-slim as production
ENV PORT=8000 \
PYTHONUNBUFFERED=1 \
PYTHONDONTWRITEBYTECODE=1 \
VIRTUAL_ENV=/opt/pysetup/.venv
ENV PATH="$VIRTUAL_ENV/bin:$PATH"
COPY --from=base $VIRTUAL_ENV $VIRTUAL_ENV
ARG userid=10001
ARG groupid=10001
RUN groupadd --gid $groupid app && \
useradd -g app --uid $userid --shell /usr/sbin/nologin --create-home app
USER app
WORKDIR /app
COPY . .
EXPOSE $PORT
CMD ["python", "-m", "asgi"]