Skip to content

Instantly share code, notes, and snippets.

@lanmaster53
Last active March 20, 2023 13:36
Show Gist options
  • Save lanmaster53/b06c0700c149dd2a2a563ce69f054d82 to your computer and use it in GitHub Desktop.
Save lanmaster53/b06c0700c149dd2a2a563ce69f054d82 to your computer and use it in GitHub Desktop.
Docker image for running Python 3 scripts in a throw-away environment.
FROM python:slim
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1
ENV TZ America/New_York
RUN mkdir -p /src
WORKDIR /src
ENTRYPOINT ["/bin/bash"]
# 1. Build the Docker image using the following command. This only needs to be done once.
# * `docker build --rm -t python3-base .`
# 2. Run a container from the same directory as the script using the following command.
# * `docker run --rm -it -v $(pwd):/src python3-base`
# 3. Use the CLI to install needed dependencies via `pip`.
# 4. Run the script.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment