Skip to content

Commit ef4a7e4

Browse files
committed
dov container: start
1 parent 518bd29 commit ef4a7e4

File tree

3 files changed

+66
-0
lines changed

3 files changed

+66
-0
lines changed

.devcontainer.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"name": "OC4IDS Datastore Pipeline Dev Container",
3+
"dockerComposeFile": "docker-compose.dev.yml",
4+
"service": "app",
5+
"workspaceFolder": "/oc4ids_datastore_pipeline",
6+
"customizations": {
7+
"vscode": {
8+
"extensions":["ms-python.python"]
9+
}
10+
}
11+
}

Dockerfile.dev

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
FROM python:3.12-bookworm
2+
3+
RUN apt-get update \
4+
&& apt-get install -y libpq-dev gcc postgresql-client
5+
6+
WORKDIR /oc4ids_datastore_pipeline
7+
8+
COPY requirements_dev.txt .
9+
10+
RUN pip install -r requirements_dev.txt
11+
12+
COPY . .
13+
14+
RUN pip install .
15+
16+
ENTRYPOINT ["sleep", "infinity"]

docker-compose.dev.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
services:
2+
app:
3+
build:
4+
context: .
5+
dockerfile: Dockerfile.dev
6+
7+
volumes:
8+
- .:/oc4ids_datastore_pipeline:cached
9+
10+
# Overrides default command so things don't shut down after the process ends.
11+
#command: sleep infinity
12+
13+
# Runs app on the same network as the database container, allows "forwardPorts" in devcontainer.json function.
14+
network_mode: service:db
15+
16+
# Use "forwardPorts" in **devcontainer.json** to forward an app port locally.
17+
# (Adding the "ports" property to this file will not forward from a Codespace.)
18+
environment:
19+
- DATABASE_URL=postgresql://postgres:postgres@localhost/postgres
20+
21+
entrypoint: sleep infinity
22+
23+
db:
24+
image: postgres:latest
25+
restart: unless-stopped
26+
volumes:
27+
- postgres-data:/var/lib/postgresql/data
28+
environment:
29+
POSTGRES_USER: postgres
30+
POSTGRES_DB: postgres
31+
POSTGRES_PASSWORD: postgres
32+
ports:
33+
- 54321:5432
34+
35+
# Add "forwardPorts": ["5432"] to **devcontainer.json** to forward PostgreSQL locally.
36+
# (Adding the "ports" property to this file will not forward from a Codespace.)
37+
38+
volumes:
39+
postgres-data:

0 commit comments

Comments
 (0)