From 8ea0365b8bbbb0a449a2a0aa17a2117693fe0709 Mon Sep 17 00:00:00 2001 From: myrmidex Date: Fri, 6 Mar 2026 23:48:46 +0100 Subject: [PATCH] 40 - Add Forgejo CI workflow for Docker builds --- .forgejo/workflows/build.yml | 41 +++++++++++++++++ README.md | 9 ++-- docker/production/docker-compose.yml | 69 ---------------------------- shell.nix | 27 ----------- 4 files changed, 45 insertions(+), 101 deletions(-) create mode 100644 .forgejo/workflows/build.yml delete mode 100644 docker/production/docker-compose.yml diff --git a/.forgejo/workflows/build.yml b/.forgejo/workflows/build.yml new file mode 100644 index 0000000..cb77b95 --- /dev/null +++ b/.forgejo/workflows/build.yml @@ -0,0 +1,41 @@ +name: Build and Push Docker Image +on: + push: + branches: [main] + tags: ['v*'] + +jobs: + build: + runs-on: docker + container: + image: catthehacker/ubuntu:act-latest + steps: + - uses: https://data.forgejo.org/actions/checkout@v4 + + - name: Set up Docker Buildx + uses: https://data.forgejo.org/docker/setup-buildx-action@v3 + + - name: Login to Forgejo Registry + uses: https://data.forgejo.org/docker/login-action@v3 + with: + registry: forge.lvl0.xyz + username: ${{ github.actor }} + password: ${{ secrets.REGISTRY_TOKEN }} + + - name: Determine tags + id: meta + run: | + if [[ "${{ github.ref }}" == refs/tags/v* ]]; then + TAG="${{ github.ref_name }}" + echo "tags=forge.lvl0.xyz/lvl0/fedi-feed-router:${TAG},forge.lvl0.xyz/lvl0/fedi-feed-router:latest" >> $GITHUB_OUTPUT + else + echo "tags=forge.lvl0.xyz/lvl0/fedi-feed-router:latest" >> $GITHUB_OUTPUT + fi + + - name: Build and push + uses: https://data.forgejo.org/docker/build-push-action@v5 + with: + context: . + file: Dockerfile + push: true + tags: ${{ steps.meta.outputs.tags }} diff --git a/README.md b/README.md index 47f8177..e11a400 100644 --- a/README.md +++ b/README.md @@ -13,14 +13,14 @@ ## Features ## Self-hosting -The production image is available at `codeberg.org/lvl0/ffr:latest`. +The production image is available at `forge.lvl0.xyz/lvl0/fedi-feed-router:latest`. ### docker-compose.yml ```yaml services: app: - image: codeberg.org/lvl0/ffr:latest + image: forge.lvl0.xyz/lvl0/fedi-feed-router:latest container_name: ffr_app restart: always ports: @@ -86,7 +86,7 @@ ## Development ### NixOS / Nix ```bash -git clone https://codeberg.org/lvl0/ffr.git +git clone https://forge.lvl0.xyz/lvl0/fedi-feed-router.git cd ffr nix-shell ``` @@ -104,7 +104,6 @@ #### Available Commands | `dev-logs-db` | Follow database logs | | `dev-shell` | Enter app container | | `dev-artisan ` | Run artisan commands | -| `prod-build [tag]` | Build and push prod image (default: latest) | #### Services @@ -125,4 +124,4 @@ ## License ## Support -For issues and questions, please use [Codeberg Issues](https://codeberg.org/lvl0/ffr/issues). +For issues and questions, please use [Issues](https://forge.lvl0.xyz/lvl0/fedi-feed-router/issues). diff --git a/docker/production/docker-compose.yml b/docker/production/docker-compose.yml deleted file mode 100644 index 20ce7c5..0000000 --- a/docker/production/docker-compose.yml +++ /dev/null @@ -1,69 +0,0 @@ -# =================== -# FFR Production Services -# =================== - -services: - app: - build: - context: ../.. - dockerfile: Dockerfile - image: codeberg.org/lvl0/ffr:latest - container_name: ffr_app - restart: unless-stopped - ports: - - "8000:8000" - environment: - APP_NAME: "${APP_NAME:-FFR}" - APP_KEY: "${APP_KEY}" - APP_URL: "${APP_URL}" - DB_HOST: db - DB_PORT: 3306 - DB_DATABASE: "${DB_DATABASE:-ffr}" - DB_USERNAME: "${DB_USERNAME:-ffr}" - DB_PASSWORD: "${DB_PASSWORD}" - REDIS_HOST: redis - REDIS_PORT: 6379 - depends_on: - db: - condition: service_healthy - redis: - condition: service_started - networks: - - ffr-network - - db: - image: mariadb:11 - container_name: ffr_db - restart: unless-stopped - environment: - MYSQL_DATABASE: "${DB_DATABASE:-ffr}" - MYSQL_USER: "${DB_USERNAME:-ffr}" - MYSQL_PASSWORD: "${DB_PASSWORD}" - MYSQL_ROOT_PASSWORD: "${DB_ROOT_PASSWORD}" - volumes: - - db_data:/var/lib/mysql - healthcheck: - test: ["CMD", "healthcheck.sh", "--connect", "--innodb_initialized"] - interval: 10s - timeout: 5s - retries: 5 - start_period: 30s - networks: - - ffr-network - - redis: - image: redis:7-alpine - container_name: ffr_redis - restart: unless-stopped - volumes: - - redis_data:/data - networks: - - ffr-network - -networks: - ffr-network: - driver: bridge - -volumes: - db_data: - redis_data: diff --git a/shell.nix b/shell.nix index e14efc4..dc33800 100644 --- a/shell.nix +++ b/shell.nix @@ -81,32 +81,6 @@ pkgs.mkShell { podman-compose -f $COMPOSE_FILE exec app php artisan "$@" } - # =================== - # PROD COMMANDS - # =================== - prod-build() { - local tag="''${1:-latest}" - local image="codeberg.org/lvl0/ffr:$tag" - - echo "Building production image: $image" - if ! podman build -t "$image" -f Dockerfile .; then - echo "Build failed!" - return 1 - fi - - echo "" - echo "Pushing to registry..." - if ! podman push "$image"; then - echo "" - echo "Push failed! You may need to login first:" - echo " podman login codeberg.org" - return 1 - fi - - echo "" - echo "Done! Image pushed: $image" - } - # =================== # WELCOME MESSAGE # =================== @@ -125,7 +99,6 @@ pkgs.mkShell { echo " dev-logs-db Tail database logs" echo " dev-shell Shell into app container" echo " dev-artisan Run artisan command" - echo " prod-build [tag] Build and push prod image (default: latest)" echo "" echo "Services:" echo " app Laravel + Vite http://localhost:8000"