Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add poetry to dev stack #11

Closed
thclark opened this issue Sep 20, 2022 · 1 comment
Closed

Add poetry to dev stack #11

thclark opened this issue Sep 20, 2022 · 1 comment
Assignees
Labels
developer experience (DX) Improves our lives/efficiency as developers devops System admin and devops

Comments

@thclark
Copy link
Contributor

thclark commented Sep 20, 2022

We need to install poetry, and pin the version.

The thing is it needs to be user specific. In slim builds the user is root:

ENV POETRY_HOME=/root/.poetry
RUN curl -sSL https://install.python-poetry.org | python -
ENV PATH "$POETRY_HOME/bin:$PATH"
RUN poetry config virtualenvs.create false

The thing is it needs to be user specific. In dev builds we need to install as the vscode user, not as root:

USER vscode
ENV POETRY_HOME=/home/vscode/.poetry
RUN curl -sSL https://install.python-poetry.org | python -
ENV PATH "$POETRY_HOME/bin:$PATH"
RUN poetry config virtualenvs.create false

EITHER

I'm not sure if a sensible thing might be to include additional stages to the build, so instead of:

  • builder
  • slim (which is actually both slim and dev)

We do:

  • builder from ${BASE_IMAGE}
  • common from ${BASE_IMAGE}
  • slim from common
  • dev from common

This will result in a small amount of duplicate code for the poetry installation, but will allow you to remove all the annoying if conditionals in for the dev tools.

OR

Experiment a bit and see if you can define the USER value based on a bash expression (root or vscode). Then do
ENV POETRY_HOME=$HOME/.poetry.

@thclark thclark added devops System admin and devops developer experience (DX) Improves our lives/efficiency as developers labels Sep 20, 2022
@thclark
Copy link
Contributor Author

thclark commented Oct 28, 2024

Deprecating in favour of #24

@thclark thclark closed this as completed Oct 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
developer experience (DX) Improves our lives/efficiency as developers devops System admin and devops
Projects
None yet
Development

No branches or pull requests

2 participants