labelmaker/Dockerfile

51 lines
1.2 KiB
Docker

FROM python:3.11.7 as base
ENV PYTHONFAULTHANDLER=1 \
PYTHONHASHSEED=random \
PYTHONUNBUFFERED=1
FROM base as builder
ENV PIP_DEFAULT_TIMEOUT=100 \
PIP_DISABLE_PIP_VERSION_CHECK=1 \
PIP_NO_CACHE_DIR=1 \
# Poetry:
POETRY_NO_INTERACTION=1 \
POETRY_VIRTUALENVS_CREATE=true \
POETRY_CACHE_DIR='/code/poetry-cache' \
POETRY_HOME='/code/poetry' \
POETRY_VERSION=1.7.1
RUN apt-get update && apt-get upgrade -y \
&& apt-get install --no-install-recommends -y \
bash \
brotli \
build-essential \
curl \
gettext \
git \
libpq-dev \
libpango-1.0.0 \
libpangocairo-1.0.0 \
# Installing `poetry`:
&& curl -sSL 'https://install.python-poetry.org' | python - \
&& /code/poetry/bin/poetry --version \
# Cleaning cache:
&& apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false \
&& apt-get clean -y && rm -rf /var/lib/apt/lists/*
WORKDIR /code
RUN groupadd -g "1000" -r web \
&& useradd -d '/code' -g web -l -r -u "1000" web \
&& chown web:web -R '/code'
COPY . /code
USER web
RUN /code/poetry/bin/poetry install --no-interaction --no-ansi --sync
CMD /code/poetry/bin/poetry run python labelmaker/main.py