This is a template for Python development on Docker with VSCode.
You can customize the details according to your own preference.
- Docker
- Python 3.12
- Support for CPU
- Package management with uv
- VScode
- Optimized setup for Python development
- Install Remote Development Extension (including Remote-SSH and Dev Containers)
- Install gcloud CLI. Log in to your account.
Using a Marketplace option is convenient (note that there is a license fee).
- For CPU (docker and docker-compose preinstalled)
Note: This template currently supports CPU only. Instead of launching VMs, I now use serverless services for GPU tasks.
You may need to SSH in and perform initial setup, so connect with gcloud compute ssh
beforehand.
-
Run
gcloud compute config-ssh
locally- Adds the VM connection settings to
~/.ssh/config
- Set the user to your own account (Tip: it's a good idea to add it to the end of the config)
Host * User your_name
- Adds the VM connection settings to
-
Select "Open a Remote Window" in the lower left corner. Select "Connect to Host". A list of VMs will appear, so select your own VM.
Clone this repository:
git clone https://github.com/shunyooo/python-blueprint.git
Run the following commands:
cd python-blueprint
. setup.sh
-
The project name in the related files will be replaced.
-
Login and configure gcloud and git on the host ( settings passed to container)
- If there is a .devcontainer in the current directory, a pop-up will appear.
- Press the pop-up to start and attach the container. Alternatively, build from "Command Palette > Dev Containers: Rebuild…".
- Once the build is complete, execute inside the container.