From 277c133ef609c91d3b1f853c785ceb24de7ab44a Mon Sep 17 00:00:00 2001 From: Adrien Merat Date: Sun, 27 Apr 2025 11:23:11 +0200 Subject: [PATCH 1/4] Add Docker compose config --- Dockerfile | 16 ++++++++++++++++ docker-compose.yaml | 28 ++++++++++++++++++++++++++++ entrypoint.sh | 5 +++++ requirements.txt | 9 +++++++++ 4 files changed, 58 insertions(+) create mode 100644 Dockerfile create mode 100644 docker-compose.yaml create mode 100644 entrypoint.sh create mode 100644 requirements.txt 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 From db398a98cd7f1d2b3808e9216511c70f0bee6079 Mon Sep 17 00:00:00 2001 From: Adrien Merat Date: Sun, 27 Apr 2025 11:23:35 +0200 Subject: [PATCH 2/4] Add GitHub workflow config --- .github/workflows/branch.yaml | 14 ++++++++++++++ .github/workflows/main.yaml | 13 +++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 .github/workflows/branch.yaml create mode 100644 .github/workflows/main.yaml diff --git a/.github/workflows/branch.yaml b/.github/workflows/branch.yaml new file mode 100644 index 0000000..e022954 --- /dev/null +++ b/.github/workflows/branch.yaml @@ -0,0 +1,14 @@ +name: Branch CI +on: + push: + branches-ignore: + - main + pull_request: +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 From da58505bd17f6f677ae33583ade03a52388245b1 Mon Sep 17 00:00:00 2001 From: Adrien Merat Date: Sun, 27 Apr 2025 11:23:57 +0200 Subject: [PATCH 3/4] Update .gitignore to exclude .idea/ --- .gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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/ From 6ed18326d36ac29fc49ff39eb957dbd47f2d5320 Mon Sep 17 00:00:00 2001 From: Adrien Merat Date: Sun, 27 Apr 2025 11:33:39 +0200 Subject: [PATCH 4/4] Remove pull request trigger from branch workflow --- .github/workflows/branch.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/branch.yaml b/.github/workflows/branch.yaml index e022954..bb21883 100644 --- a/.github/workflows/branch.yaml +++ b/.github/workflows/branch.yaml @@ -3,7 +3,6 @@ on: push: branches-ignore: - main - pull_request: jobs: Build-And-Test: runs-on: ubuntu-latest