File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ __pycache__/
1616.hypothesis /
1717pip-log.txt
1818pip-delete-this-directory.txt
19+ requirements.txt
1920
2021# Editor directories and OS files
2122.idea /
@@ -41,4 +42,13 @@ mkdocs.yml
4142
4243# Project files you don't want in image
4344LICENSE
44- Makefile
45+ Makefile
46+
47+ # Github
48+ .devcontainer /
49+ .github /
50+
51+ # Docker files
52+ Dockerfile
53+ docker-compose.yml
54+ .dockerignore
Original file line number Diff line number Diff line change @@ -21,6 +21,8 @@ COPY . /app
2121RUN --mount=type=cache,target=/root/.cache/uv \
2222 uv sync --locked --no-dev
2323
24+ # Remove the uv lock file and pyproject.toml, so that the final image does not
25+ RUN rm -f pyproject.toml uv.lock .python-version
2426
2527# Then, use a final image without uv
2628FROM python:3.12-slim-bookworm
@@ -36,4 +38,4 @@ WORKDIR /app
3638# Place executables in the environment at the front of the path
3739ENV PATH="/app/.venv/bin:$PATH"
3840
39- ENTRYPOINT ["/bin/sh" , "./docker/docker-entrypoint.sh" ]
41+ CMD ["/bin/sh" , "./docker/docker-entrypoint.sh" ]
Original file line number Diff line number Diff line change 11PROJECT_NAME = python-boilerplate
2+ CONTAINER_NAME = py-blplt
3+ d = docker
4+ dc = docker compose
25
36run :
47 uv run __main__.py
@@ -16,25 +19,31 @@ typecheck:
1619 uv run mypy --config-file=pyproject.toml --explicit-package-bases ./src/
1720
1821docker-build :
19- docker build -t $(PROJECT_NAME ) .
22+ $(d ) build -t $(PROJECT_NAME ) .
23+
24+ docker-bash :
25+ $(d ) run --rm -it --env-file .env $(PROJECT_NAME ) /bin/bash
2026
2127docker-run :
22- docker run --rm -it --env-file example.env $(PROJECT_NAME )
28+ $(d ) run --rm -it --env-file .env $(PROJECT_NAME )
29+
30+ docker-logs :
31+ $(d ) logs -f $(CONTAINER_NAME )
2332
2433compose-build :
25- docker compose up --build -d
34+ $( dc ) up --build -d
2635
2736compose-up :
28- docker compose up -d
37+ $( dc ) up -d
2938
3039compose-stop :
31- docker compose stop
40+ $( dc ) stop
3241
3342compose-down :
34- docker compose down
43+ $( dc ) down
3544
3645clean :
3746 find . -type d -name ' __pycache__' -exec rm -rf {} +
3847 rm -rf .mypy_cache .ruff_cache .pytest_cache
3948
40- .PHONY : run test lint format typecheck check docker-build docker-run compose-build compose-up compose-stop compose-down clean
49+ .PHONY : run test lint format typecheck check docker-build docker-bash docker- run compose-build compose-up compose-stop compose-down clean
You can’t perform that action at this time.
0 commit comments