From 09a2afa41ab936290546165584e5fdfaa3d1849c Mon Sep 17 00:00:00 2001 From: Marijn Doeve Date: Sun, 9 Apr 2023 17:14:59 +0200 Subject: [PATCH] Test runner gitea --- .gitea/workflows/docker.yaml | 66 ++++++++++++++++++++++++++++++++++++ docker/web/Containerfile | 5 +++ 2 files changed, 71 insertions(+) create mode 100644 .gitea/workflows/docker.yaml create mode 100644 docker/web/Containerfile diff --git a/.gitea/workflows/docker.yaml b/.gitea/workflows/docker.yaml new file mode 100644 index 0000000..3120227 --- /dev/null +++ b/.gitea/workflows/docker.yaml @@ -0,0 +1,66 @@ +name: Build and Deploy + +on: + push: + branches: ["master"] + # Publish semver tags as releases. + tags: ["v*.*.*"] + pull_request: + branches: ["master"] + schedule: + - cron: "0 1 * * *" + workflow_dispatch: + +env: + # # Use docker.io for Docker Hub if empty + # REGISTRY: ghcr.io + # github.repository as / + IMAGE_NAME: ${{ github.repository }} + +jobs: + build: + name: Build Image + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + # Workaround: https://github.com/docker/build-push-action/issues/461 + - name: Setup Docker buildx + uses: docker/setup-buildx-action@v2 + + # Login against a Docker registry except on PR + # https://github.com/docker/login-action + - name: Log into registry ${{ env.REGISTRY }} + if: github.event_name != 'pull_request' + uses: docker/login-action@v2 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + # Extract metadata (tags, labels) for Docker + # https://github.com/docker/metadata-action + - name: Extract Docker metadata + id: meta + uses: docker/metadata-action@v4 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + + # Build and push Docker image with Buildx (don't push on PR) + # https://github.com/docker/build-push-action + - name: Build and push Docker image + id: build-and-push + uses: docker/build-push-action@v3 + with: + context: . + file: docker/web/Containerfile + push: ${{ github.event_name != 'pull_request' }} + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + cache-from: type=gha + cache-to: type=gha,mode=max diff --git a/docker/web/Containerfile b/docker/web/Containerfile new file mode 100644 index 0000000..d998e4a --- /dev/null +++ b/docker/web/Containerfile @@ -0,0 +1,5 @@ +FROM php:8.2-apache + +RUN apt-get update \ + && apt-get install -y libpq-dev \ + && docker-php-ext-install pdo_psql \ No newline at end of file