File tree Expand file tree Collapse file tree 4 files changed +36
-2
lines changed Expand file tree Collapse file tree 4 files changed +36
-2
lines changed Original file line number Diff line number Diff line change 1+ services :
2+ web :
3+ build :
4+ context : app
5+ target : dev-envs
6+ ports :
7+ - ' 8000:8000'
8+ volumes :
9+ - /var/run/docker.sock:/var/run/docker.sock
Original file line number Diff line number Diff line change @@ -50,3 +50,10 @@ Stop and remove the containers
5050```
5151$ docker compose down
5252```
53+ ## Use with Docker Development Environments
54+
55+ You can use this sample with the Dev Environments feature of Docker Desktop.
56+ To develop directly the web service inside a container, you just need to use the https git url of the sample:
57+ ` https://github.com/docker/awesome-compose/tree/master/django `
58+
59+ ![ page] ( ../dev-envs.png )
Original file line number Diff line number Diff line change 1- FROM python:3.7-alpine
1+ # syntax=docker/dockerfile:1.4
2+
3+ FROM --platform=$BUILDPLATFORM python:3.7-alpine AS builder
24EXPOSE 8000
35WORKDIR /app
46COPY requirements.txt /app
57RUN pip3 install -r requirements.txt --no-cache-dir
68COPY . /app
79ENTRYPOINT ["python3" ]
810CMD ["manage.py" , "runserver" , "0.0.0.0:8000" ]
11+
12+ FROM builder as dev-envs
13+ RUN <<EOF
14+ apk update
15+ apk add git
16+ EOF
17+
18+ RUN <<EOF
19+ addgroup -S docker
20+ adduser -S --shell /bin/bash --ingroup docker vscode
21+ EOF
22+ # install Docker tools (cli, buildx, compose)
23+ COPY --from=gloursdocker/docker / /
24+ CMD ["manage.py" , "runserver" , "0.0.0.0:8000" ]
Original file line number Diff line number Diff line change 11services :
22 web :
3- build : app
3+ build :
4+ context : app
5+ target : builder
46 ports :
57 - ' 8000:8000'
You can’t perform that action at this time.
0 commit comments