diff --git a/.forgejo/workflows/build-push.yml b/.forgejo/workflows/build-push.yml index e0501f9..673d9cd 100644 --- a/.forgejo/workflows/build-push.yml +++ b/.forgejo/workflows/build-push.yml @@ -5,7 +5,7 @@ on: branches: - main - master - - fix_robustness_dockerize_project + - 'ci/*' tags: - 'v*' diff --git a/Dockerfile b/Dockerfile index 639045e..4e9a9a7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,22 +1,18 @@ -# Use official lightweight Python base image FROM python:3.11-slim -# Set working directory inside container WORKDIR /app -# Install Python dependencies first to leverage Docker layer caching +# Prevent Python from writing .pyc files & buffer stdout/stderr +ENV PYTHONDONTWRITEBYTECODE=1 \ + PYTHONUNBUFFERED=1 \ + PORT=8000 \ + USER_AGENT="Phikipathia/1.0 (https://git.depeuter.dev/tdpeuter/2022ST-project-Phikipathia)" + COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt -# Copy application files COPY . . -# Expose default port EXPOSE 8000 -# Set default environment variables -ENV PORT=8000 -ENV USER_AGENT="Phikipathia/1.0 (Wikipedia Philosophy Path Visualizer; https://github.com/tdpeuter/2022ST-project-Phikipathia)" - -# Run Python HTTP server CMD ["python", "server.py"] diff --git a/cgi-bin/scraper.py b/cgi-bin/scraper.py index e48883e..a7fe6ca 100644 --- a/cgi-bin/scraper.py +++ b/cgi-bin/scraper.py @@ -18,7 +18,7 @@ import requests # Default HTTP User-Agent adhering to Wikimedia API policy DEFAULT_USER_AGENT = ( - "Phikipathia/1.0 (https://github.com/tdpeuter/2022ST-project-Phikipathia; contact@phikipathia.org)" + "Phikipathia/1.0 (https://git.depeuter.dev/tdpeuter/2022ST-project-Phikipathia; contact@phikipathia.org)" ) # Per-request HTTP timeout in seconds diff --git a/docker-compose.yml b/docker-compose.yml index 37a64e3..57d3d5c 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -10,7 +10,7 @@ services: - "${PORT:-8000}:8000" environment: - PORT=8000 - - USER_AGENT=${USER_AGENT:-Phikipathia/1.0 (https://github.com/tdpeuter/2022ST-project-Phikipathia)} + - USER_AGENT=${USER_AGENT:-Phikipathia/1.0 (https://git.depeuter.dev/tdpeuter/2022ST-project-Phikipathia)} healthcheck: test: ["CMD-SHELL", "python -c 'import urllib.request; urllib.request.urlopen(\"http://localhost:8000/\")'"] interval: 30s diff --git a/index.html b/index.html index 388cda4..48ee37d 100644 --- a/index.html +++ b/index.html @@ -22,7 +22,12 @@