diff --git a/.gitea/workflows/build-deploy-alternative.yml.disabled b/.gitea/workflows/build-deploy-alternative.yml.disabled new file mode 100644 index 0000000..aa18b31 --- /dev/null +++ b/.gitea/workflows/build-deploy-alternative.yml.disabled @@ -0,0 +1,80 @@ +# ALTERNATIVE SOLUTION: Configure runner with Docker CLI pre-installed +# +# This file shows how to set up the Gitea runner to have Docker CLI available +# by default, eliminating the need for Docker-in-Docker. +# +# SETUP INSTRUCTIONS: +# +# 1. SSH into your server where the Gitea runner is running +# +# 2. Find the runner container or installation: +# docker ps | grep act_runner +# +# 3. Option A: If runner is in Docker, create custom runner image +# Create a Dockerfile: +# +# FROM gitea/act_runner:latest +# RUN apk add --no-cache docker-cli +# +# Build and use: +# docker build -t gitea-runner-with-docker . +# # Update docker-compose or run command to use this image +# +# 4. Option B: If runner is installed on host, install Docker CLI: +# +# # For Ubuntu/Debian host +# curl -fsSL https://get.docker.com -o get-docker.sh +# sh get-docker.sh +# +# # Restart the runner service +# systemctl restart act_runner +# +# 5. Once Docker CLI is available in runner, use this simpler workflow: + +name: Build and Push Docker Image + +on: + push: + branches: + - main + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Verify Docker is available + run: docker version + + - name: Log in to Gitea Container Registry + run: | + echo "${{ secrets.GITHUB_TOKEN }}" | docker login code.puffinoffset.com -u ${{ github.actor }} --password-stdin + + - name: Build Docker image + run: | + docker build -t code.puffinoffset.com/matt/puffin-app:latest \ + -t code.puffinoffset.com/matt/puffin-app:main-${{ github.sha }} \ + . + + - name: Push Docker images + run: | + docker push code.puffinoffset.com/matt/puffin-app:latest + docker push code.puffinoffset.com/matt/puffin-app:main-${{ github.sha }} + + - name: Show image info + run: | + docker images | grep puffin-app + +# BENEFITS OF THIS APPROACH: +# - Faster workflow execution (no container setup overhead) +# - Simpler workflow file +# - Better caching between builds +# - More control over runner environment +# +# WHEN TO USE: +# - If you have access to modify the runner +# - If you run multiple workflows that need Docker +# - For production environments where performance matters diff --git a/.gitea/workflows/build-deploy.yml b/.gitea/workflows/build-deploy.yml index 08f1ab3..deeaeb0 100644 --- a/.gitea/workflows/build-deploy.yml +++ b/.gitea/workflows/build-deploy.yml @@ -8,25 +8,14 @@ on: jobs: build: runs-on: ubuntu-latest + container: + image: docker:24-dind + options: --privileged steps: - name: Checkout code uses: actions/checkout@v4 - - name: Install Docker CLI - run: | - sudo apt-get update - sudo apt-get install -y ca-certificates curl - sudo install -m 0755 -d /etc/apt/keyrings - sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc - sudo chmod a+r /etc/apt/keyrings/docker.asc - echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null - sudo apt-get update - sudo apt-get install -y docker-ce-cli - - - name: Verify Docker installation - run: docker version - - name: Log in to Gitea Container Registry run: | echo "${{ secrets.GITHUB_TOKEN }}" | docker login code.puffinoffset.com -u ${{ github.actor }} --password-stdin