diff --git a/Dockerfile b/Dockerfile index d518c94..f0f254c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,22 +1,29 @@ -FROM python:3.11.4 as base +FROM python:3.11.4-slim as base MAINTAINER JP Hanna "jpl.hanna@gmail.com" WORKDIR /app/ COPY . /app/ FROM base as install-poetry -ENV POETRY_VIRTUALENVS_CREATE=false \ - POETRY_VERSION=1.5.1 +ENV PIPX_BIN_DIR="/opt/pipx" \ + POETRY_NO_INTERACTION=true \ + POETRY_VIRTUALENVS_CREATE=false \ + POETRY_VIRTUALENVS_IN_PROJECT=false \ + POETRY_CACHE_DIR="/opt/poetry" \ + POETRY_VERSION=1.7.0 \ + PATH="/root/.local/share/pipx/venvs/poetry/bin:$PATH" +ENV PATH="$POETRY_VIRTUALENVS_PATH/bin:$PIPX_BIN_DIR:$PATH" -RUN pip install pipx -RUN pipx install poetry==$POETRY_VERSION + +RUN pip install --upgrade pip \ + && pip install pipx \ + && pipx install poetry==$POETRY_VERSION RUN apt-get update && apt-get install -y --no-install-recommends gcc -ENV PATH "/root/.local/bin:$PATH" # Install python dependencies in /.venv -RUN poetry install --no-root --no-ansi --no-interaction --only=main +RUN poetry install --no-root --no-ansi --no-interaction --only=main --no-directory # Install application into container -ENV PYTHONPATH "{$PYTHONPATH}:/app/" +ENV PYTHONPATH "$PYTHONPATH:/app/" FROM install-poetry as install-dev -RUN poetry install --no-root --no-ansi --no-interaction --only=dev +RUN poetry install --no-root --no-ansi --no-interaction --only=dev --no-directory