Last active
February 20, 2019 14:44
-
-
Save natitomattis/ba0f85190ad0f9654114a5a01449340b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ## 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