ci: switch from GitLab CI to Gitea Actions, fix Dockerfile.backend
- Replace .gitlab-ci.yml with .gitea/workflows/deploy.yml - Fix Dockerfile.backend: add scan_processor.py and searcher_v3.py to COPY command (they were missing, would cause runtime ImportError) - Update docker-compose.yml comment to reference Gitea workflow Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
53
.gitea/workflows/deploy.yml
Normal file
53
.gitea/workflows/deploy.yml
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
# ──────────────────────────────────────────────────────────────────────────────
|
||||||
|
# Flight Radar — Gitea Actions CI/CD
|
||||||
|
#
|
||||||
|
# PREREQUISITES (one-time setup — see README for full instructions):
|
||||||
|
#
|
||||||
|
# 1. Add the act_runner service to your Gitea Portainer stack.
|
||||||
|
#
|
||||||
|
# 2. Pre-create the runner config file on the host:
|
||||||
|
# /srv/docker/traefik/stacks/gitea/volumes/act_runner/config.yaml
|
||||||
|
# (see content in the README / deployment docs)
|
||||||
|
#
|
||||||
|
# 3. Start the runner, then grab the registration token from:
|
||||||
|
# Gitea → Site Administration → Runners → Create Runner
|
||||||
|
# Add ACT_RUNNER_TOKEN to Portainer stack environment variables.
|
||||||
|
#
|
||||||
|
# 4. Give the runner access to Docker (socket mounted via config.yaml).
|
||||||
|
#
|
||||||
|
# PIPELINE BEHAVIOUR:
|
||||||
|
# • Triggers on every push to the default branch (main).
|
||||||
|
# • Builds both Docker images on the server (no registry needed).
|
||||||
|
# • Brings the app up with docker compose; only changed services restart.
|
||||||
|
# • If the build fails the old containers keep running — no downtime.
|
||||||
|
# • Prunes dangling images after a successful deploy.
|
||||||
|
# ──────────────────────────────────────────────────────────────────────────────
|
||||||
|
|
||||||
|
name: Deploy
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
|
||||||
|
env:
|
||||||
|
COMPOSE_PROJECT: flight-radar
|
||||||
|
COMPOSE_FILE: flight-comparator/docker-compose.yml
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
deploy:
|
||||||
|
runs-on: ubuntu-latest # resolved to catthehacker/ubuntu:act-22.04 by runner config
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Deploy with docker compose
|
||||||
|
run: |
|
||||||
|
echo "=== Deploying commit ${{ gitea.sha }} to ${{ gitea.ref_name }} ==="
|
||||||
|
docker compose -f "$COMPOSE_FILE" -p "$COMPOSE_PROJECT" up --build -d --remove-orphans
|
||||||
|
|
||||||
|
- name: Prune dangling images
|
||||||
|
run: docker image prune -f
|
||||||
|
|
||||||
|
- name: Show running containers
|
||||||
|
run: docker compose -f "$COMPOSE_FILE" -p "$COMPOSE_PROJECT" ps
|
||||||
@@ -1,50 +0,0 @@
|
|||||||
# ──────────────────────────────────────────────────────────────────────────────
|
|
||||||
# Flight Radar — GitLab CI/CD
|
|
||||||
#
|
|
||||||
# PREREQUISITES (one-time setup on the server):
|
|
||||||
#
|
|
||||||
# 1. Install GitLab Runner
|
|
||||||
# https://docs.gitlab.com/runner/install/linux-manually/
|
|
||||||
#
|
|
||||||
# 2. Register the runner (shell executor, tag: "shell")
|
|
||||||
# gitlab-runner register \
|
|
||||||
# --url https://gitlab.com \
|
|
||||||
# --registration-token <YOUR_PROJECT_TOKEN> \
|
|
||||||
# --executor shell \
|
|
||||||
# --tag-list shell \
|
|
||||||
# --description "flight-radar-server"
|
|
||||||
#
|
|
||||||
# 3. Give the runner access to Docker (no sudo needed)
|
|
||||||
# sudo usermod -aG docker gitlab-runner
|
|
||||||
# sudo systemctl restart gitlab-runner
|
|
||||||
#
|
|
||||||
# PIPELINE BEHAVIOUR:
|
|
||||||
# • Triggers on every push to the default branch (main).
|
|
||||||
# • Builds both Docker images on the server (no registry needed).
|
|
||||||
# • Brings the app up with docker compose; only changed services restart.
|
|
||||||
# • If the build fails the old containers keep running — no downtime.
|
|
||||||
# • Prunes dangling images after a successful deploy.
|
|
||||||
# ──────────────────────────────────────────────────────────────────────────────
|
|
||||||
|
|
||||||
stages:
|
|
||||||
- deploy
|
|
||||||
|
|
||||||
variables:
|
|
||||||
# Stable project name so containers are found across different checkout dirs
|
|
||||||
COMPOSE_PROJECT: flight-radar
|
|
||||||
# Path to compose file (relative to repo root = $CI_PROJECT_DIR)
|
|
||||||
COMPOSE_FILE: flight-comparator/docker-compose.yml
|
|
||||||
|
|
||||||
deploy:
|
|
||||||
stage: deploy
|
|
||||||
tags:
|
|
||||||
- shell # must match the tag you gave your runner at registration
|
|
||||||
rules:
|
|
||||||
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
|
|
||||||
script:
|
|
||||||
- echo "=== Deploying commit $CI_COMMIT_SHORT_SHA to $CI_COMMIT_BRANCH ==="
|
|
||||||
- docker compose -f "$COMPOSE_FILE" -p "$COMPOSE_PROJECT" up --build -d --remove-orphans
|
|
||||||
- echo "=== Cleaning up dangling images ==="
|
|
||||||
- docker image prune -f
|
|
||||||
- echo "=== Running containers ==="
|
|
||||||
- docker compose -f "$COMPOSE_FILE" -p "$COMPOSE_PROJECT" ps
|
|
||||||
@@ -14,7 +14,7 @@ WORKDIR /app
|
|||||||
COPY requirements.txt .
|
COPY requirements.txt .
|
||||||
RUN pip install --no-cache-dir -r requirements.txt
|
RUN pip install --no-cache-dir -r requirements.txt
|
||||||
|
|
||||||
COPY api_server.py airports.py cache.py ./
|
COPY api_server.py airports.py cache.py scan_processor.py searcher_v3.py ./
|
||||||
COPY database/ ./database/
|
COPY database/ ./database/
|
||||||
|
|
||||||
# Pre-fetch airport data and initialise the database at build time
|
# Pre-fetch airport data and initialise the database at build time
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
name: flight-radar # pins the project name — must match COMPOSE_PROJECT in .gitlab-ci.yml
|
name: flight-radar # pins the project name — must match COMPOSE_PROJECT in .gitea/workflows/deploy.yml
|
||||||
|
|
||||||
services:
|
services:
|
||||||
backend:
|
backend:
|
||||||
|
|||||||
Reference in New Issue
Block a user