Skip to content

Instantly share code, notes, and snippets.

@JoshuaSchlichting
Last active January 30, 2023 23:52
Show Gist options
  • Select an option

  • Save JoshuaSchlichting/1268fe4088588287ae9b3383b2dcea75 to your computer and use it in GitHub Desktop.

Select an option

Save JoshuaSchlichting/1268fe4088588287ae9b3383b2dcea75 to your computer and use it in GitHub Desktop.
Interactive Python Docker container with Poetry installed
{
docker build -t pyshell . -f-<<EOF
FROM python:latest
RUN useradd -m -U -G staff -s /bin/bash devuser
USER devuser
WORKDIR /home/devuser
RUN mkdir /home/devuser/bin
ENV POETRY_HOME="/home/devuser/bin/poetry"
RUN curl -sSL https://install.python-poetry.org | python -
ENV PATH="/home/devuser/bin/poetry/bin:$PATH"
RUN poetry config virtualenvs.create false
ENTRYPOINT [ "/bin/bash" ]
EOF
} || {
echo "Failed to build docker image"; exit 1;
}
docker run \
--rm \
-it \
--name pyshell \
--volume $(pwd):/workdir \
-v $PWD:/workdir \
-w /workdir \
pyshell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment