Skip to content

Commit

Permalink
WIP devcontainer
Browse files Browse the repository at this point in the history
  • Loading branch information
mooster531 committed Dec 16, 2024
1 parent 700f701 commit cd177d4
Show file tree
Hide file tree
Showing 7 changed files with 201 additions and 137 deletions.
44 changes: 44 additions & 0 deletions .devcontainer/.devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
"name": "dune-sync development container",
"dockerComposeFile": "../docker-compose.yml",
"service": "app",
"features": {
"ghcr.io/devcontainers/features/python:latest": {
"installTools": false,
"version": "3.13"
}
},
"customizations": {
"jetbrains": {
"settings": {
"com.intellij:app:EditorSettings.is_ensure_newline_at_eof": true,
"com.intellij:app:GeneralSettings.searchInBackground": true,
"Git4Idea:app:Git-Application-Settings.myPathToGit": "/usr/bin/git",
"org.jetbrains.plugins.github:app:GithubSettings.clone_git_using_ssh": true,
"com.intellij:app:Vcs-Log-App-Settings.show_changes_from_parents": true,
}
},
"vscode": {
"extensions": [
"ms-python.python",
"ms-python.black-formatter",
"charliermarsh.ruff"
],
"settings": {
"python.defaultInterpreterPath": "/usr/local/bin/python",
"python.linting.enabled": true,
"python.linting.pylintEnabled": false,
"python.linting.ruffEnabled": true,
"python.formatting.provider": "black",
"editor.formatOnSave": true
}
}
},
"postCreateCommand": "poetry install --no-root",
"containerEnv": {
"PYTHONPATH": "../",
},
"remoteEnv": {
"PYTHONPATH": "../"
}
}
33 changes: 0 additions & 33 deletions .devcontainer/devcontainer.json

This file was deleted.

1 change: 1 addition & 0 deletions .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ jobs:
with:
context: .
file: Dockerfile
target: prod
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
34 changes: 26 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,30 @@
FROM python:3.13-alpine
# Base
FROM python:3.13-slim AS base

# Install system dependencies and poetry
RUN apt-get update && \
apt-get install -y --no-install-recommends curl bash git && \
pip install poetry && \
rm -rf /var/lib/apt/lists/*

RUN python -m pip install poetry
RUN mkdir /app
RUN apk add bash
COPY src /app/src
COPY poetry.lock /app/poetry.lock
COPY pyproject.toml /app/pyproject.toml
WORKDIR /app
COPY src /app/src
COPY pyproject.toml poetry.lock* ./
RUN POETRY_VIRTUALENVS_CREATE=false python -m poetry install --no-dev

# Dev
FROM base AS dev
RUN POETRY_VIRTUALENVS_CREATE=false python -m poetry install

#CMD ["python", "-m", "src.main"]

# Prod
FROM python:3.13-alpine AS prod

COPY --from=base /app/src /app/src/
COPY --from=base /usr/local/lib/python3.13/site-packages /usr/local/lib/python3.13/site-packages

WORKDIR /app

USER 1000
ENTRYPOINT [ "python", "-m" , "src.main"]
ENTRYPOINT [ "/usr/local/bin/python", "-m" , "src.main"]
30 changes: 30 additions & 0 deletions Dockerfile.dev
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Base
FROM python:3.13-slim AS base

# Install system dependencies and poetry
RUN apt-get update && \
apt-get install -y --no-install-recommends curl bash git && \
pip install poetry && \
rm -rf /var/lib/apt/lists/*

WORKDIR /app
COPY src /app/src
COPY pyproject.toml poetry.lock* ./
RUN POETRY_VIRTUALENVS_CREATE=false python -m poetry install --no-dev

# Dev
FROM base AS dev
RUN POETRY_VIRTUALENVS_CREATE=false python -m poetry install

CMD ["python", "-m", "src.main"]

# Prod
FROM python:3.13-alpine AS prod

COPY --from=base /app/src /app/src/
COPY --from=base /usr/local/lib/python3.13/site-packages /usr/local/lib/python3.13/site-packages

WORKDIR /app

USER 1000
ENTRYPOINT [ "/usr/local/bin/python", "-m" , "src.main"]
4 changes: 4 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ services:
networks:
- monitor-net
user: "1000"
app:
build:
dockerfile: Dockerfile
# target: base
volumes:
pg_data:
prometheus_data: { }
Expand Down
Loading

0 comments on commit cd177d4

Please sign in to comment.