Here is how to configure VS Code for line-by-line debugging a .NET Core 2.1 application in a Docker container
-
Start microsoft/dotnet:2.1-sdk interactively
docker run --rm -it \ -v ${PWD}:/app \
version: "2.4" | |
services: | |
db: | |
image: postgres:12.0-alpine | |
volumes: | |
- pg-data:/var/lib/postgresql/data | |
- ./db/init:/docker-entrypoint-initdb.d | |
ports: | |
- 5432 | |
environment: |
kafka-console-consumer \ | |
--bootstrap-server kafka:9092 \ | |
--topic demo-topic \ | |
--from-beginning |
kafka-console-producer \ | |
--broker-list kafka:9092 \ | |
--topic demo-topic |
kafka-topics --bootstrap-server kafka:9092 \ | |
--create \ | |
--topic demo-topic \ | |
--partitions 3 \ | |
--replication-factor 1 |
version: "2.3" | |
services: | |
zookeeper: | |
image: confluentinc/cp-zookeeper:5.3.0 | |
hostname: zookeeper | |
environment: | |
ZOOKEEPER_CLIENT_PORT: 2181 | |
ZOOKEEPER_TICK_TIME: 2000 | |
kafka: |
FROM python:2.7 | |
RUN mkdir -p /app | |
WORKDIR /app | |
COPY requirements.txt /app/ | |
# for debugging purposes | |
COPY ./pycharm-debug.egg /app/ | |
RUN pip install -r requirements.txt | |
COPY . /app |
from flask import Flask, jsonify | |
app = Flask(__name__) | |
tasks = [ | |
{ | |
'id': 1, | |
'title': u'Buy groceries', | |
'description': u'Milk, Cheese, Pizza, Fruit, Tylenol', |
FROM python:2.7 | |
RUN mkdir -p /app | |
WORKDIR /app | |
COPY requirements.txt /app/ | |
RUN pip install -r requirements.txt | |
# for debugging purposes | |
RUN pip install ptvsd | |
COPY . /app |
{ | |
"name": "Attach (Remote Debug)", | |
"type": "python", | |
"request": "attach", | |
"localRoot": "${workspaceRoot}", | |
"remoteRoot": "${workspaceRoot}", | |
"port": 3000, | |
"secret": "my_secret", | |
"host": "localhost" | |
} |