diff --git a/.github/workflows/docker-build.yaml b/.github/workflows/docker-build.yaml new file mode 100644 index 0000000..89aa400 --- /dev/null +++ b/.github/workflows/docker-build.yaml @@ -0,0 +1,76 @@ +name: "Build docker images" + +on: + push: + branches: + - "master" + schedule: + - cron: "0 5 * * 4" + +permissions: + contents: read + packages: write + # This is used to complete the identity challenge + # with sigstore/fulcio when running outside of PRs. + id-token: write + +jobs: + build: + runs-on: "ubuntu-latest" + strategy: + matrix: + context: + - traefik + - nextcloud-web + - nextcloud-fpm + + steps: + - uses: "actions/checkout@v4" + + - name: "Install cosign" + uses: "sigstore/cosign-installer@v3.7.0" + + - uses: "docker/setup-buildx-action@v3.7.1" + + # Login against a Docker registry except on PR + # https://github.com/docker/login-action + - uses: "docker/login-action@v3.3.0" + with: + registry: "ghcr.io" + 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@v5.5.1" + with: + images: "ghcr.io/${{ github.repository }}/${{ matrix.context }}" + + # 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@v6.9.0" + with: + context: "docker/${{ matrix.context }}" + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + cache-from: type=gha + cache-to: type=gha,mode=max + + # Sign the resulting Docker image digest except on PRs. + # This will only write to the public Rekor transparency log when the Docker + # repository is public to avoid leaking data. If you would like to publish + # transparency data even for private images, pass --force to cosign below. + # https://github.com/sigstore/cosign + - name: Sign the published Docker image + env: + # https://docs.github.com/en/actions/security-guides/security-hardening-for-github-actions#using-an-intermediate-environment-variable + TAGS: ${{ steps.meta.outputs.tags }} + DIGEST: ${{ steps.build-and-push.outputs.digest }} + # This step uses the identity token to provision an ephemeral certificate + # against the sigstore community Fulcio instance. + run: echo "${TAGS}" | xargs -I {} cosign sign --yes {}@${DIGEST} diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml deleted file mode 100644 index c704dd3..0000000 --- a/.gitlab-ci.yml +++ /dev/null @@ -1,63 +0,0 @@ -stages: - - "build" - -build-traefik: - stage: "build" - - image: - name: "docker:stable" - - services: - - name: "docker:dind" - alias: "dockerdaemon" - - variables: - DOCKER_HOST: "tcp://dockerdaemon:2375/" - DOCKER_DRIVER: "overlay2" - DOCKER_TLS_CERTDIR: "" - - script: - - docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" "$CI_REGISTRY" - - docker build -t "$CI_REGISTRY_IMAGE/traefik:latest" docker/traefik - - docker push "$CI_REGISTRY_IMAGE/traefik:latest" - - -build-nextcloud-fpm: - stage: "build" - - image: - name: "docker:stable" - - services: - - name: "docker:dind" - alias: "dockerdaemon" - - variables: - DOCKER_HOST: "tcp://dockerdaemon:2375/" - DOCKER_DRIVER: "overlay2" - DOCKER_TLS_CERTDIR: "" - - script: - - docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" "$CI_REGISTRY" - - docker build -t "$CI_REGISTRY_IMAGE/nextcloud/fpm:latest" docker/nextcloud/fpm - - docker push "$CI_REGISTRY_IMAGE/nextcloud/fpm:latest" - -build-nextcloud-web: - stage: "build" - - image: - name: "docker:stable" - - services: - - name: "docker:dind" - alias: "dockerdaemon" - - variables: - DOCKER_HOST: "tcp://dockerdaemon:2375/" - DOCKER_DRIVER: "overlay2" - DOCKER_TLS_CERTDIR: "" - - script: - - docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" "$CI_REGISTRY" - - docker build -t "$CI_REGISTRY_IMAGE/nextcloud/web:latest" docker/nextcloud/web - - docker push "$CI_REGISTRY_IMAGE/nextcloud/web:latest" diff --git a/docker/nextcloud/fpm/Dockerfile b/docker/nextcloud-fpm/Dockerfile similarity index 100% rename from docker/nextcloud/fpm/Dockerfile rename to docker/nextcloud-fpm/Dockerfile diff --git a/docker/nextcloud/fpm/php.ini b/docker/nextcloud-fpm/php.ini similarity index 100% rename from docker/nextcloud/fpm/php.ini rename to docker/nextcloud-fpm/php.ini diff --git a/docker/nextcloud/fpm/www.conf b/docker/nextcloud-fpm/www.conf similarity index 100% rename from docker/nextcloud/fpm/www.conf rename to docker/nextcloud-fpm/www.conf diff --git a/docker/nextcloud/web/Dockerfile b/docker/nextcloud-web/Dockerfile similarity index 100% rename from docker/nextcloud/web/Dockerfile rename to docker/nextcloud-web/Dockerfile diff --git a/docker/nextcloud/web/nginx.conf b/docker/nextcloud-web/nginx.conf similarity index 100% rename from docker/nextcloud/web/nginx.conf rename to docker/nextcloud-web/nginx.conf