Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: docker #4

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"isort",
"linebreak",
"markdownlint",
"pyproject",
"pytest",
"shellcheck",
"shfmt",
Expand Down
16 changes: 16 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"name": "py-template-devcontainer",
"dockerComposeFile": "../compose.yaml",
"service": "py-sample",
"workspaceFolder": "/app",
"customizations": {
"vscode": {
"extensions": [
"charliermarsh.ruff",
"ms-python.vscode-pylance",

Check warning on line 10 in .devcontainer/devcontainer.json

View workflow job for this annotation

GitHub Actions / spell-check

Unknown word (pylance)
"ms-python.python",
"ms-python.debugpy"
]
}
}
}
16 changes: 16 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# https://docs.astral.sh/uv/guides/integration/docker/#installing-uv
FROM python:3.12-slim-bookworm
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/

WORKDIR /app

COPY pyproject.toml uv.lock README.md /app/
COPY projects/ /app/projects

RUN apt-get update && apt-get install -y --no-install-recommends \
git \
&& rm -rf /var/lib/apt/lists/*

RUN uv sync

CMD ["/bin/bash"]
17 changes: 17 additions & 0 deletions compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
services:
py-sample:
build:
context: .
dockerfile: Dockerfile
# args:
# - GITHUB_TOKEN=${GITHUB_TOKEN:-}
# environment:
# LOG_LEVEL: ${LOG_LEVEL}
# ports:
# - ${HOST_BINDING:-}${HOST_PORT}:{CONTAINER_PORT}
# depends_on:
# - other_service
volumes:
- ./projects:/app/projects
- ./.vscode:/app/.vscode
restart: unless-stopped
1 change: 1 addition & 0 deletions projects/prj0/.python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.12
Empty file added projects/prj0/README.md
Empty file.
11 changes: 11 additions & 0 deletions projects/prj0/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[project]
name = "prj0"
version = "0.1.0"
description = "Add your description here"
readme = "README.md"
requires-python = ">=3.12"
dependencies = []

[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
2 changes: 2 additions & 0 deletions projects/prj0/src/prj0/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
def hello() -> str:
return "Hello from prj0!"
Empty file added projects/prj0/src/prj0/py.typed
Empty file.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ packages = ["sample"]
[tool.uv]
dev-dependencies = [
"pytest>=8.3.3",
"ruff==0.7.0",
"ruff==0.8.0",
]

[tool.uv.workspace]
Expand Down
108 changes: 108 additions & 0 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading