diff --git a/.github/workflows/branch.yaml b/.github/workflows/branch.yaml new file mode 100644 index 0000000..bb21883 --- /dev/null +++ b/.github/workflows/branch.yaml @@ -0,0 +1,13 @@ +name: Branch CI +on: + push: + branches-ignore: + - main +jobs: + Build-And-Test: + runs-on: ubuntu-latest + steps: + - name: Checkout Repository + uses: actions/checkout@v4 + - name: Build Docker Images + run: docker compose build diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml new file mode 100644 index 0000000..b91d2ca --- /dev/null +++ b/.github/workflows/main.yaml @@ -0,0 +1,13 @@ +name: Branch CI +on: + push: + branches: + - main +jobs: + Build-And-Test: + runs-on: ubuntu-latest + steps: + - name: Checkout Repository + uses: actions/checkout@v4 + - name: Build Docker Images + run: docker compose build diff --git a/.gitignore b/.gitignore index 0a19790..3b58d13 100644 --- a/.gitignore +++ b/.gitignore @@ -165,7 +165,7 @@ cython_debug/ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore # and can be added to the global gitignore or merged into this file. For a more nuclear # option (not recommended) you can uncomment the following to ignore the entire idea folder. -#.idea/ +.idea/ # Ruff stuff: .ruff_cache/ diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..d816ffc --- /dev/null +++ b/Dockerfile @@ -0,0 +1,16 @@ +FROM python:3.11-slim + +RUN mkdir /berlin-transit +WORKDIR /berlin-transit + +RUN apt-get update && apt-get install -y \ + build-essential \ + libpq-dev + +COPY requirements.txt . +RUN pip install --no-cache-dir -r requirements.txt + +COPY . . +RUN chmod +x /berlin-transit/entrypoint.sh + +ENTRYPOINT ["/berlin-transit/entrypoint.sh"] diff --git a/docker-compose.yaml b/docker-compose.yaml new file mode 100644 index 0000000..4173c81 --- /dev/null +++ b/docker-compose.yaml @@ -0,0 +1,28 @@ +services: + postgres: + image: postgres:15.6 + environment: + POSTGRES_USER: postgres + POSTGRES_PASSWORD: S3cr3t_P4ssw0rd + POSTGRES_DB: transit + volumes: + - pgdata:/var/lib/postgresql/data + healthcheck: + test: ["CMD-SHELL", "pg_isready -U postgres"] + interval: 5s + timeout: 5s + retries: 10 + + app: + build: . + depends_on: + - postgres + ports: + - "5000:5000" + environment: + FLASK_APP: app + FLASK_ENV: development + DATABASE_URL: postgresql://postgres:S3cr3t_P4ssw0rd@postgres:5432/transit + +volumes: + pgdata: diff --git a/entrypoint.sh b/entrypoint.sh new file mode 100644 index 0000000..c7527de --- /dev/null +++ b/entrypoint.sh @@ -0,0 +1,5 @@ +#!/usr/bin/env bash + +set -ex + +exit 0 diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..da27122 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,9 @@ +dash==3.0.3 +psycopg2-binary==2.9.10 +sqlalchemy==2.0.40 +alembic==1.15.2 +pandas==2.2.3 +requests==2.32.3 +pytz==2025.2 +pytest==8.3.5 +pytest-mock==3.14.0