Skip to content

Commit 949d432

Browse files
committed
usable dev file
1 parent 3521569 commit 949d432

File tree

4 files changed

+55
-18
lines changed

4 files changed

+55
-18
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
FROM mcr.microsoft.com/devcontainers/python:3.12-bookworm
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"build": {
3+
"dockerfile": "Dockerfile",
4+
"context": ".."
5+
},
6+
"features": {
7+
"ghcr.io/defanglabs/devcontainer-feature/defang-cli:1.0.4": {},
8+
"ghcr.io/devcontainers/features/docker-in-docker:2": {},
9+
"ghcr.io/devcontainers/features/aws-cli:1": {}
10+
}
11+
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
services:
2+
db:
3+
extends:
4+
file: compose.yaml
5+
service: db
6+
volumes:
7+
- postgres_data:/var/lib/postgresql/data
8+
environment:
9+
- POSTGRES_PASSWORD=password
10+
11+
runmigrations:
12+
extends:
13+
file: compose.yaml
14+
service: django
15+
restart: on-failure
16+
environment:
17+
- DEBUG=False
18+
- POSTGRES_PASSWORD=password
19+
command: python manage.py migrate
20+
depends_on:
21+
- db
22+
23+
django:
24+
extends:
25+
file: compose.yaml
26+
service: django
27+
environment:
28+
- DEBUG=False
29+
- POSTGRES_PASSWORD=password
30+
volumes:
31+
- "./app:/code"
32+
command: python manage.py runserver 0.0.0.0:8000
33+
depends_on:
34+
- runmigrations
35+
36+
volumes:
37+
postgres_data:

samples/django-postgres/compose.yaml

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,38 +2,26 @@ services:
22
db:
33
restart: unless-stopped
44
image: postgres:16
5-
volumes: ["./tmp/postgres:/var/lib/postgresql/data/"]
65
environment:
7-
- POSTGRES_DB=mydatabase
8-
- POSTGRES_USER=myuser
6+
- POSTGRES_DB=django
7+
- POSTGRES_USER=django
98
- POSTGRES_PASSWORD
109
ports:
1110
- mode: host
1211
target: 5432
13-
#deploy:
14-
# resources:
15-
# reservations:
16-
# memory: 256M
1712

18-
django-crm:
13+
django:
1914
restart: unless-stopped
2015
build: ./app
2116
ports:
2217
- mode: ingress
2318
target: 8000
24-
# Uncomment the following line if you want to run it locally
25-
# published: 8000
19+
published: 8000
2620
environment:
2721
- DB_HOST=db
2822
- DEBUG=False
29-
- POSTGRES_USER=myuser
30-
- POSTGRES_DB=mydatabase
23+
- POSTGRES_USER=django
24+
- POSTGRES_DB=django
3125
- POSTGRES_PASSWORD
32-
# deploy:
33-
# resources:
34-
# reservations:
35-
# memory: 2GB
36-
# volumes: [".:/code"]
3726
depends_on:
3827
- db
39-
# command: python manage.py runserver 0.0.0.0:8000

0 commit comments

Comments
 (0)