Skip to content

Commit cd177d4

Browse files
committed
WIP devcontainer
1 parent 700f701 commit cd177d4

7 files changed

Lines changed: 201 additions & 137 deletions

File tree

.devcontainer/.devcontainer.json

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
{
2+
"name": "dune-sync development container",
3+
"dockerComposeFile": "../docker-compose.yml",
4+
"service": "app",
5+
"features": {
6+
"ghcr.io/devcontainers/features/python:latest": {
7+
"installTools": false,
8+
"version": "3.13"
9+
}
10+
},
11+
"customizations": {
12+
"jetbrains": {
13+
"settings": {
14+
"com.intellij:app:EditorSettings.is_ensure_newline_at_eof": true,
15+
"com.intellij:app:GeneralSettings.searchInBackground": true,
16+
"Git4Idea:app:Git-Application-Settings.myPathToGit": "/usr/bin/git",
17+
"org.jetbrains.plugins.github:app:GithubSettings.clone_git_using_ssh": true,
18+
"com.intellij:app:Vcs-Log-App-Settings.show_changes_from_parents": true,
19+
}
20+
},
21+
"vscode": {
22+
"extensions": [
23+
"ms-python.python",
24+
"ms-python.black-formatter",
25+
"charliermarsh.ruff"
26+
],
27+
"settings": {
28+
"python.defaultInterpreterPath": "/usr/local/bin/python",
29+
"python.linting.enabled": true,
30+
"python.linting.pylintEnabled": false,
31+
"python.linting.ruffEnabled": true,
32+
"python.formatting.provider": "black",
33+
"editor.formatOnSave": true
34+
}
35+
}
36+
},
37+
"postCreateCommand": "poetry install --no-root",
38+
"containerEnv": {
39+
"PYTHONPATH": "../",
40+
},
41+
"remoteEnv": {
42+
"PYTHONPATH": "../"
43+
}
44+
}

.devcontainer/devcontainer.json

Lines changed: 0 additions & 33 deletions
This file was deleted.

.github/workflows/deploy.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ jobs:
3535
with:
3636
context: .
3737
file: Dockerfile
38+
target: prod
3839
push: true
3940
tags: ${{ steps.meta.outputs.tags }}
4041
labels: ${{ steps.meta.outputs.labels }}

Dockerfile

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,30 @@
1-
FROM python:3.13-alpine
1+
# Base
2+
FROM python:3.13-slim AS base
3+
4+
# Install system dependencies and poetry
5+
RUN apt-get update && \
6+
apt-get install -y --no-install-recommends curl bash git && \
7+
pip install poetry && \
8+
rm -rf /var/lib/apt/lists/*
29

3-
RUN python -m pip install poetry
4-
RUN mkdir /app
5-
RUN apk add bash
6-
COPY src /app/src
7-
COPY poetry.lock /app/poetry.lock
8-
COPY pyproject.toml /app/pyproject.toml
910
WORKDIR /app
11+
COPY src /app/src
12+
COPY pyproject.toml poetry.lock* ./
13+
RUN POETRY_VIRTUALENVS_CREATE=false python -m poetry install --no-dev
14+
15+
# Dev
16+
FROM base AS dev
1017
RUN POETRY_VIRTUALENVS_CREATE=false python -m poetry install
18+
19+
#CMD ["python", "-m", "src.main"]
20+
21+
# Prod
22+
FROM python:3.13-alpine AS prod
23+
24+
COPY --from=base /app/src /app/src/
25+
COPY --from=base /usr/local/lib/python3.13/site-packages /usr/local/lib/python3.13/site-packages
26+
27+
WORKDIR /app
28+
1129
USER 1000
12-
ENTRYPOINT [ "python", "-m" , "src.main"]
30+
ENTRYPOINT [ "/usr/local/bin/python", "-m" , "src.main"]

Dockerfile.dev

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Base
2+
FROM python:3.13-slim AS base
3+
4+
# Install system dependencies and poetry
5+
RUN apt-get update && \
6+
apt-get install -y --no-install-recommends curl bash git && \
7+
pip install poetry && \
8+
rm -rf /var/lib/apt/lists/*
9+
10+
WORKDIR /app
11+
COPY src /app/src
12+
COPY pyproject.toml poetry.lock* ./
13+
RUN POETRY_VIRTUALENVS_CREATE=false python -m poetry install --no-dev
14+
15+
# Dev
16+
FROM base AS dev
17+
RUN POETRY_VIRTUALENVS_CREATE=false python -m poetry install
18+
19+
CMD ["python", "-m", "src.main"]
20+
21+
# Prod
22+
FROM python:3.13-alpine AS prod
23+
24+
COPY --from=base /app/src /app/src/
25+
COPY --from=base /usr/local/lib/python3.13/site-packages /usr/local/lib/python3.13/site-packages
26+
27+
WORKDIR /app
28+
29+
USER 1000
30+
ENTRYPOINT [ "/usr/local/bin/python", "-m" , "src.main"]

docker-compose.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,10 @@ services:
5353
networks:
5454
- monitor-net
5555
user: "1000"
56+
app:
57+
build:
58+
dockerfile: Dockerfile
59+
# target: base
5660
volumes:
5761
pg_data:
5862
prometheus_data: { }

0 commit comments

Comments
 (0)