Skip to content

Instantly share code, notes, and snippets.

@natitomattis
Last active February 20, 2019 14:44
Show Gist options
  • Select an option

  • Save natitomattis/ba0f85190ad0f9654114a5a01449340b to your computer and use it in GitHub Desktop.

Select an option

Save natitomattis/ba0f85190ad0f9654114a5a01449340b to your computer and use it in GitHub Desktop.
## Source https://github.com/DonJayamanne/vscode-python-samples/tree/master/remote-debugging-docker
## Dockerfile
FROM python:3.6-alpine
COPY . src/
RUN pip install --no-cache ptvsd
EXPOSE 3000
CMD ["python", "src/sample.py"]
## sample.py
import ptvsd
import time
import os
print("Waiting to attach")
address = ('0.0.0.0', 3000)
ptvsd.enable_attach(address)
ptvsd.wait_for_attach()
time.sleep(2)
print("attached")
print("end")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment