From 5fd084702ffd7d5b57e1ecff1bd402a1e0b87821 Mon Sep 17 00:00:00 2001 From: kbe Date: Sun, 20 Jul 2025 16:38:14 +0200 Subject: [PATCH] Add docker files --- .dockerignore | 6 ++++++ .gitignore | 8 +------- Dockerfile | 29 +++++++++++++++++++++++++++++ docker-compose.yml | 20 ++++++++++++++++++++ 4 files changed, 56 insertions(+), 7 deletions(-) create mode 100644 .dockerignore create mode 100644 Dockerfile create mode 100644 docker-compose.yml diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..3cd7b42 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,6 @@ +# Exclude Python virtual environment +.env +venv/ +env/ +__pycache__/ +*.py[cod] diff --git a/.gitignore b/.gitignore index 4544309..753dc64 100644 --- a/.gitignore +++ b/.gitignore @@ -177,10 +177,4 @@ poetry.toml # LSP config files pyrightconfig.json -# End of https://www.toptal.com/developers/gitignore/api/python - -# Docker -docker-compose.override.yml -docker-compose.yml -Dockerfile -.dockerignore +# End of https://www.toptal.com/developers/gitignore/api/python \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..b387001 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,29 @@ +# Use the official Python image from Docker Hub +FROM python:3.11-slim + +# Set the working directory +WORKDIR /app + +# Set environment variables using the ARG values +ENV CROSSFIT_USERNAME=${CROSSFIT_USERNAME} +ENV CROSSFIT_PASSWORD=${CROSSFIT_PASSWORD} +ENV EMAIL_FROM=${EMAIL_FROM} +ENV EMAIL_TO=${EMAIL_TO} +ENV EMAIL_PASSWORD=${EMAIL_PASSWORD} +ENV TELEGRAM_TOKEN=${TELEGRAM_TOKEN} +ENV TELEGRAM_CHAT_ID=${TELEGRAM_CHAT_ID} + +# Copy the requirements file +COPY requirements.txt . + +# Install the required dependencies +RUN pip install --no-cache-dir -r requirements.txt + +# Copy the rest of the application code +COPY . . + +# Create log directory +RUN mkdir -p log + +# Set the entry point to run the main script +ENTRYPOINT ["python", "book_crossfit.py"] diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..76c083c --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,20 @@ +version: '3.8' + +services: + crossfit-booker: + build: + context: . + dockerfile: Dockerfile + container_name: crossfit-booker + environment: + - CROSSFIT_USERNAME=${CROSSFIT_USERNAME} + - CROSSFIT_PASSWORD=${CROSSFIT_PASSWORD} + - SMTP_SERVER=${SMTP_SERVER} + - EMAIL_FROM=${EMAIL_FROM} + - EMAIL_TO=${EMAIL_TO} + - EMAIL_PASSWORD=${EMAIL_PASSWORD} + - TELEGRAM_TOKEN=${TELEGRAM_TOKEN} + - TELEGRAM_CHAT_ID=${TELEGRAM_CHAT_ID} + volumes: + - ./log:/app/log + restart: unless-stopped \ No newline at end of file