2020-10-26 17:00:02 +00:00
|
|
|
# https://hub.docker.com/_/python
|
2020-11-23 17:37:03 +00:00
|
|
|
FROM python:3.9-slim-buster
|
2020-10-26 17:00:02 +00:00
|
|
|
|
2020-11-23 17:23:00 +00:00
|
|
|
# for pip cache:
|
|
|
|
ENV XDG_CACHE_HOME=/var/cache
|
|
|
|
|
|
|
|
ENV PYTHONUNBUFFERED=1
|
2020-11-14 19:12:39 +00:00
|
|
|
|
2020-10-26 17:00:02 +00:00
|
|
|
# Install deps
|
2020-11-23 17:37:03 +00:00
|
|
|
RUN set -x \
|
|
|
|
&& apt-get update \
|
2020-10-26 17:00:02 +00:00
|
|
|
&& apt-mark auto $(apt-mark showinstall) \
|
|
|
|
&& apt-get install -y postgresql-client-11 python3-pip \
|
|
|
|
&& apt autoremove \
|
|
|
|
&& apt -y full-upgrade \
|
|
|
|
&& rm -rf /var/lib/apt \
|
2020-11-13 08:26:58 +00:00
|
|
|
&& python3 -m pip install -U pip \
|
|
|
|
&& pip install -U psycopg2-binary
|
2020-10-26 17:00:02 +00:00
|
|
|
|
2020-11-23 17:37:03 +00:00
|
|
|
# Create user for application server:
|
|
|
|
RUN set -x \
|
|
|
|
&& addgroup --system django \
|
2020-11-22 13:13:38 +00:00
|
|
|
&& adduser --system --no-create-home --disabled-password --ingroup django --shell /bin/bash django
|
|
|
|
|
2020-11-14 19:12:39 +00:00
|
|
|
WORKDIR /django
|
2020-10-26 17:00:02 +00:00
|
|
|
|
2020-11-23 17:37:03 +00:00
|
|
|
ARG PROJECT_PACKAGE_NAME
|
|
|
|
ENV PROJECT_PACKAGE_NAME=${PROJECT_PACKAGE_NAME}
|
|
|
|
|
|
|
|
ARG PROJECT_VERSION
|
|
|
|
ENV PROJECT_VERSION=${PROJECT_VERSION}
|
|
|
|
|
|
|
|
# Install project:
|
|
|
|
RUN set -x \
|
|
|
|
&& pip install "${PROJECT_PACKAGE_NAME}>=${PROJECT_VERSION}"
|
2020-10-26 17:00:02 +00:00
|
|
|
|
|
|
|
|