Skip to content

Commit

Permalink
chore: Install Poetry under /opt/poetry-env as non-root user
Browse files Browse the repository at this point in the history
Co-authored-by: Laurent Sorber <laurent.sorber@gmail.com>
  • Loading branch information
sinopeus and lsorber committed Nov 22, 2023
1 parent ea06cbb commit a21b0d2
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions {{ cookiecutter.__package_name_kebab_case }}/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@ WORKDIR /workspaces/{{ cookiecutter.__package_name_kebab_case }}/

FROM base as builder

USER root

# Install Poetry in separate venv so it doesn't pollute the main venv.
ENV POETRY_VERSION 1.6.1
ENV POETRY_VIRTUAL_ENV /opt/poetry-env
Expand All @@ -45,11 +43,11 @@ RUN --mount=type=cache,target=/root/.cache/pip/ \
RUN ln -s $POETRY_VIRTUAL_ENV/bin/poetry /usr/bin/poetry

# Install compilers that may be required for certain packages or platforms.
USER root
RUN --mount=type=cache,target=/var/cache/apt/ \
--mount=type=cache,target=/var/lib/apt/ \
apt-get update && \
apt-get install --no-install-recommends --yes build-essential

USER user

# Install the run time Python dependencies in the virtual environment.
Expand Down

0 comments on commit a21b0d2

Please sign in to comment.