add Dockerfile

This commit is contained in:
2024-09-14 21:46:21 +02:00
parent b1a1fb7c94
commit cdc64afd1f
4 changed files with 31 additions and 0 deletions

2
.dockerignore Normal file
View File

@@ -0,0 +1,2 @@
__pycache__
.venv

1
.gitignore vendored
View File

@@ -1 +1,2 @@
__pycache__
.venv

9
Dockerfile Normal file
View File

@@ -0,0 +1,9 @@
FROM python:3.12-slim
COPY --from=ghcr.io/astral-sh/uv:latest /uv /bin/uv
COPY uv.lock pyproject.toml ./
RUN uv sync --frozen
COPY ./simulation simulation
ENTRYPOINT [ "uv", "run", "python", "-m", "simulation.app" ]

19
Makefile Normal file
View File

@@ -0,0 +1,19 @@
GIT_COMMIT_HASH := $(shell git rev-parse --short HEAD)
DOCKER_REGISTRY = registry.crapts.org
all: run
run:
uv run python -m simulation.app
docker/build:
docker build -t simulation:latest .
docker/run: docker/build
docker run -it --rm simulation
docker/push: docker/build
docker tag simulation:latest $(DOCKER_REGISTRY)/simulation:latest
docker tag simulation:latest $(DOCKER_REGISTRY)/simulation:$(GIT_COMMIT_HASH)
docker push $(DOCKER_REGISTRY)/simulation:latest
docker push $(DOCKER_REGISTRY)/simulation:$(GIT_COMMIT_HASH)