forked from r888888888/recommender
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Dockerfile
31 lines (26 loc) · 1.08 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
FROM python:3.7.12
WORKDIR /recommender
# https://github.com/python-poetry/poetry/discussions/1879#discussioncomment-216865
ENV \
# https://stackoverflow.com/questions/59812009/what-is-the-use-of-pythonunbuffered-in-docker-file
PYTHONUNBUFFERED=1 \
# https://python-docs.readthedocs.io/en/latest/writing/gotchas.html#disabling-bytecode-pyc-files
PYTHONDONTWRITEBYTECODE=1 \
# https://stackoverflow.com/questions/45594707/what-is-pips-no-cache-dir-good-for
PIP_NO_CACHE_DIR=1 \
# https://stackoverflow.com/questions/46288847/how-to-suppress-pip-upgrade-warning
PIP_DISABLE_PIP_VERSION_CHECK=1
RUN \
groupadd --gid 999 recommender && \
useradd --gid 999 --uid 999 --create-home recommender && \
chown recommender:recommender /recommender && \
apt-get update && \
apt-get install -y --no-install-recommends tini postgresql-client && \
pip install "poetry==1.1.11"
USER recommender
COPY pyproject.toml poetry.lock ./
RUN poetry install --no-dev
COPY . .
EXPOSE 5000
ENTRYPOINT ["tini", "--"]
CMD ["python", "-m", "poetry", "run", "gunicorn", "wsgi", "--bind", "0.0.0.0:5000"]