testing. #151
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Create and publish Backend Docker image | |
on: | |
push: | |
branches: [ "master", "develop"] | |
pull_request: | |
branches: [ "master" ] | |
env: | |
# 🖊️ EDIT to change the image registry settings. | |
# Registries such as GHCR, Quay.io, and Docker Hub are supported. | |
IMAGE_REGISTRY: ghcr.io/utrechtuniversity | |
IMAGE_REGISTRY_USER: ${{ github.actor }} | |
IMAGE_REGISTRY_PASSWORD: ${{ github.token }} | |
TAG_NAME: ${{ github.repository }} | |
IMAGE_NAME: ${{ github.repository }}-backend | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
# Sets the permissions granted to the `GITHUB_TOKEN` for the actions in this job. | |
permissions: | |
contents: read | |
packages: write | |
attestations: write | |
id-token: write | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Build the Docker image | |
id: build-image | |
uses: redhat-actions/buildah-build@v2 | |
with: | |
image: Nginx | |
tags: latest | |
dockerfiles: | | |
./openshift/nginx.dockerfile | |
# This step uses the `docker/build-push-action` action to build the image, based on your repository's `Dockerfile`. If the build succeeds, it pushes the image to GitHub Packages. | |
# It uses the `context` parameter to define the build's context as the set of files located in the specified path. For more information, see "[Usage](https://github.com/docker/build-push-action#usage)" in the README of the `docker/build-push-action` repository. | |
# It uses the `tags` and `labels` parameters to tag and label the image with the output from the "meta" step. | |
- name: Install dependencies | |
env: | |
COMPOSER_AUTH: '{"github-oauth": {"github.com": "${{secrets.COMPOSER_AUTH}}"} }' # [tl! **] | |
run: composer install --prefer-dist --no-suggest --no-progress | |
- name: Build and push Docker image | |
id: push | |
uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4 | |
with: | |
file: ./openshift/openshift.dockerfile | |
context: . | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }}-labels | |
- name: Push to registry | |
id: push-image | |
uses: redhat-actions/push-to-registry@v2 | |
with: | |
image: ${{ steps.build-image.outputs.image }} | |
tags: ${{ steps.build-image.outputs.tags }} | |
registry: ${{ env.IMAGE_REGISTRY }} | |
username: ${{ env.IMAGE_REGISTRY_USER }} | |
password: ${{ env.IMAGE_REGISTRY_PASSWORD }} |