Skip to content

Commit

Permalink
Docker: Label the containers with the repo origin
Browse files Browse the repository at this point in the history
  • Loading branch information
quartje committed Oct 11, 2023
1 parent 2c5126d commit 7d2afd2
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 46 deletions.
91 changes: 46 additions & 45 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 3 additions & 1 deletion docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ RUN yarn install && \

FROM ghcr.io/openconext/openconext-containers/openconext-httpd:latest AS httpd-build
LABEL maintainer Bart Geesink ([email protected])
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/
Expand All @@ -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" <[email protected]>
LABEL maintainer Bart Geesink ([email protected])
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 && \
Expand Down

0 comments on commit 7d2afd2

Please sign in to comment.