2023-11-16 15:26:49 +00:00
|
|
|
FROM python:3.12.0-slim-bullseye
|
2023-01-05 20:10:17 +00:00
|
|
|
|
2024-01-14 20:28:38 +00:00
|
|
|
ENV VERSION_NUMBER=1.5.2 \
|
2023-11-16 15:26:49 +00:00
|
|
|
PROD=1 \
|
|
|
|
PYTHONUNBUFFERED=1 \
|
|
|
|
PYTHONFAULTHANDLER=1 \
|
|
|
|
PYTHONHASHSEED=random \
|
|
|
|
PYTHONDONTWRITEBYTECODE=1 \
|
|
|
|
PIP_NO_CACHE_DIR=1 \
|
|
|
|
PIP_DISABLE_PIP_VERSION_CHECK=1 \
|
|
|
|
PIP_DEFAULT_TIMEOUT=100 \
|
|
|
|
PIP_ROOT_USER_ACTION=ignore \
|
|
|
|
POETRY_NO_INTERACTION=1 \
|
|
|
|
POETRY_VIRTUALENVS_CREATE=false \
|
|
|
|
POETRY_CACHE_DIR='/var/cache/pypoetry' \
|
|
|
|
POETRY_HOME='/usr/local'
|
2023-01-05 20:10:17 +00:00
|
|
|
|
2023-11-16 15:26:49 +00:00
|
|
|
RUN apt-get update && apt-get upgrade -y \
|
|
|
|
&& apt-get install --no-install-recommends -y \
|
|
|
|
bash \
|
|
|
|
curl \
|
|
|
|
&& curl -sSL 'https://install.python-poetry.org' | python - \
|
|
|
|
&& poetry --version \
|
|
|
|
&& apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false \
|
|
|
|
&& apt-get clean -y && rm -rf /var/lib/apt/lists/*
|
2023-01-05 20:10:17 +00:00
|
|
|
|
2023-11-16 15:26:49 +00:00
|
|
|
RUN useradd -m --uid 1000 timetracker \
|
|
|
|
&& mkdir -p '/var/www/django/static' \
|
|
|
|
&& chown timetracker:timetracker '/var/www/django/static'
|
2023-01-02 17:11:43 +00:00
|
|
|
WORKDIR /home/timetracker/app
|
2023-01-03 13:29:39 +00:00
|
|
|
COPY . /home/timetracker/app/
|
|
|
|
RUN chown -R timetracker:timetracker /home/timetracker/app
|
|
|
|
COPY entrypoint.sh /
|
|
|
|
RUN chmod +x /entrypoint.sh
|
2023-01-05 20:56:57 +00:00
|
|
|
|
2023-11-16 15:26:49 +00:00
|
|
|
RUN --mount=type=cache,target="$POETRY_CACHE_DIR" \
|
|
|
|
echo "$PROD" \
|
|
|
|
&& poetry version \
|
|
|
|
&& poetry run pip install -U pip \
|
|
|
|
&& poetry install --only main --no-interaction --no-ansi --sync
|
|
|
|
|
2023-01-02 17:26:24 +00:00
|
|
|
USER timetracker
|
2023-01-05 20:56:57 +00:00
|
|
|
|
2023-01-03 13:29:39 +00:00
|
|
|
EXPOSE 8000
|
2023-09-16 16:24:10 +00:00
|
|
|
CMD [ "/entrypoint.sh" ]
|