Skip to content

Commit

Permalink
Rework TIMESTAMP ARG to (hopefully) work; manually set PATH to includ…
Browse files Browse the repository at this point in the history
…e pipx installs
  • Loading branch information
miker985 committed Jan 18, 2024
1 parent c6c9e84 commit 5d4504c
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions images/python-base/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
# e.g., "3.10"
# > An ARG declared before a FROM is outside of a build stage, so it can't be used in any instruction after a FROM
# https://docs.docker.com/engine/reference/builder/#understand-how-arg-and-from-interact

# Specify "base" Python image e.g., "3.10"
ARG PYTHON_VERSION
# e.g., 2024.01.17.15.09.31
ARG TIMESTAMP

FROM python:${PYTHON_VERSION}-slim as python-base-BASE

# For tracking deployed images later e.g., 2024.01.17.15.09.31
ARG TIMESTAMP

# Python
ENV PYTHONUNBUFFERED=1 \
# prevents python creating .pyc files
Expand All @@ -18,19 +22,16 @@ ENV PYTHONUNBUFFERED=1 \
# do not ask any interactive question
POETRY_NO_INTERACTION=1 \
# never create virtual environment automaticly, only use env prepared by us
POETRY_VIRTUALENVS_CREATE=false
POETRY_VIRTUALENVS_CREATE=false \
# Update PATH to include pipx defautl
PATH="/root/.local/bin:${PATH}"

# Install pipx. pipx installs Python CLI programs in an isolated environment
# in addition it makes the CLI entry points available on $PATH
RUN pip install --upgrade pipx && \
pipx ensurepath
RUN pip install --upgrade pipx

# Install poetry via pipx
# https://python-poetry.org/docs/#installing-with-pipx
#
# NOTE: this will emit "'/root/.local/bin' is not on your PATH environment variable."
# This is true at install time but at runtime a new shell will be started that
# has that fixed per `pipx ensurepath` above
RUN pipx install poetry

# Leave a note behind so we can always quickly determine our original image
Expand Down

0 comments on commit 5d4504c

Please sign in to comment.