Skip to content

Commit

Permalink
Update the docker file to utilize pipx and an up to date version of p…
Browse files Browse the repository at this point in the history
…oetry
  • Loading branch information
JP Hanna committed Dec 31, 2023
1 parent bb0076d commit 30c3672
Showing 1 changed file with 16 additions and 9 deletions.
25 changes: 16 additions & 9 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,22 +1,29 @@
FROM python:3.11.4 as base
FROM python:3.11.4-slim as base
MAINTAINER JP Hanna "[email protected]"
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

0 comments on commit 30c3672

Please sign in to comment.