diff --git a/Dockerfile b/Dockerfile index aafa859..460ab8b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,18 @@ -FROM python:3.11.7-slim-bookworm +FROM python:3.11.7-alpine + +# Wersja i data builda jako build-arg +ARG APP_VERSION=unknown +ARG BUILD_DATE=unknown + +# Ustawiamy zmienne w ENV, by były dostępne w kontenerze +ENV APP_VERSION=$APP_VERSION +ENV BUILD_DATE=$BUILD_DATE + WORKDIR /app + COPY api . + +RUN apk add --no-cache curl RUN pip install -r requirements.txt -CMD python3 app.py + +CMD python3 app.py \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index 4717f40..b3d8e0c 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -7,9 +7,24 @@ services: build: . env_file: - api/.env + ports: + - 80:80 + healthcheck: + test: ["CMD", "curl", "-f", "http://localhost/health"] + interval: 10s + timeout: 5s + retries: 5 + start_period: 15s db: container_name: db hostname: db image: mysql:latest env_file: - db/.env + ports: + - 3306:3306 + healthcheck: + test: ["CMD", "mysqladmin", "ping", "-h", "localhost"] + interval: 10s + timeout: 5s + retries: 5 \ No newline at end of file