From 7d2afd212995cd24cf22124b32f3a22f21a0d662 Mon Sep 17 00:00:00 2001 From: Bart Geesink Date: Wed, 11 Oct 2023 12:23:03 +0200 Subject: [PATCH] Docker: Label the containers with the repo origin --- .github/workflows/main.yml | 91 +++++++++++++++++++------------------- docker/Dockerfile | 4 +- 2 files changed, 49 insertions(+), 46 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 8a91e4d07..3b15cf84e 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -11,58 +11,59 @@ on: jobs: build: runs-on: ubuntu-20.04 - permissions: + permissions: packages: write + contents: read steps: - - name: Check out the repo - uses: actions/checkout@v3 + - name: Check out the repo + uses: actions/checkout@v3 - - uses: actions/setup-node@v3 - with: - node-version: 14 + - uses: actions/setup-node@v3 + with: + node-version: 14 - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 - - name: Login to GitHub Container Registry - uses: docker/login-action@v2 - with: - registry: ghcr.io - username: ${{ github.repository_owner }} - password: ${{ secrets.GITHUB_TOKEN }} + - name: Login to GitHub Container Registry + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} - - name: Set docker metadata for php fpm container - id: meta - uses: docker/metadata-action@v5 - with: - images: | - ghcr.io/surfnet/sp-dashboard/spdashboard_php-fpm - tags: | - type=schedule - type=ref,event=branch - type=ref,event=pr - type=semver,pattern={{version}} - type=semver,pattern={{major}}.{{minor}} - type=semver,pattern={{major}} - type=sha + - name: Set docker metadata for php fpm container + id: meta + uses: docker/metadata-action@v5 + with: + images: | + ghcr.io/surfnet/sp-dashboard/spdashboard_php-fpm + tags: | + type=schedule + type=ref,event=branch + type=ref,event=pr + type=semver,pattern={{version}} + type=semver,pattern={{major}}.{{minor}} + type=semver,pattern={{major}} + type=sha - - name: Build the php-fpm container and push to GitHub Packages - uses: docker/build-push-action@v4 - with: - context: . - file: docker/Dockerfile - push: true - tags: ${{ steps.meta.outputs.tags }} - target: phpfpm-build + - name: Build the php-fpm container and push to GitHub Packages + uses: docker/build-push-action@v4 + with: + context: . + file: docker/Dockerfile + push: true + tags: ${{ steps.meta.outputs.tags }} + target: phpfpm-build - - name: Build the Apache container and push to GitHub Packages - uses: docker/build-push-action@v1 - with: - dockerfile: docker/Dockerfile - registry: ghcr.io - repository: surfnet/sp-dashboard/spdashboard_web - tag_with_ref: true - push: true - target: httpd-build + - name: Build the Apache container and push to GitHub Packages + uses: docker/build-push-action@v1 + with: + dockerfile: docker/Dockerfile + registry: ghcr.io + repository: surfnet/sp-dashboard/spdashboard_web + tag_with_ref: true + push: true + target: httpd-build diff --git a/docker/Dockerfile b/docker/Dockerfile index 884edaa2d..36d3351e1 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -12,6 +12,7 @@ RUN yarn install && \ FROM ghcr.io/openconext/openconext-containers/openconext-httpd:latest AS httpd-build LABEL maintainer Bart Geesink (bart.geesink@surf.nl) +LABEL org.opencontainers.image.source=https://github.com/surfnet/sp-dashboard RUN mkdir -p /var/www/html/ COPY --from=node-build /var/www/html/public/. /var/www/html/public/ COPY --from=js-build /var/www/html/public/build/. /var/www/html/public/build/ @@ -37,7 +38,8 @@ COPY --from=node-build /var/www/html/composer.json /var/www/html/ COPY --from=js-build /var/www/html/public/build/. /var/www/html/public/build/ COPY --from=js-build /var/www/html/node_modules/. /var/www/html/node_modules/ -LABEL maintainer "Bart Geesink" +LABEL maintainer Bart Geesink (bart.geesink@surf.nl) +LABEL org.opencontainers.image.source=https://github.com/surfnet/sp-dashboard RUN mkdir -p /var/www/html/var/cache && \ mkdir -p /var/www/html/var/log && \