Skip to content

ar2pi/run-python-script

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

run-python-script

Dockerhub

Requirements

Run containerized python script

docker run -v $(pwd):/code ar2pi/run-python-script python script_file.py

Debug within container

docker run -it -v $(pwd):/code ar2pi/run-python-script /bin/bash

Setup new project

export PROJECT_NAME=[YOUR_PROJECT_NAME]
git clone git@github.com:ar2pi/run-python-script.git $PROJECT_NAME
cd $PROJECT_NAME
rm -rvf .git
docker build -t $PROJECT_NAME .

# run main.py
docker run -v $(pwd)/src:/code $PROJECT_NAME
# debug
docker run -it -v $(pwd)/src:/code $PROJECT_NAME /bin/bash

Dev container

To get intellisense and all that jazz your editor needs to run in a container with python's runtime and libraries.

Vscode

When opening the project folder you should see an option "Reopen in Container" ➜ click on that. Or open the command palette (CTRL + Shift + P) + search for "Dev Containers: Reopen in Container".

.devcontainer.json contains the necessary configuration.

For reference see vscode docs.

Build

docker buildx build \
  --platform linux/amd64,linux/arm64 \
  -t ar2pi/run-python-script \
  --push .

About

Boilerplate to run containerized python scripts.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published