Skip to content

feat: Add CI/CD pipeline, testing framework, Slurm environment setup,… #2

feat: Add CI/CD pipeline, testing framework, Slurm environment setup,…

feat: Add CI/CD pipeline, testing framework, Slurm environment setup,… #2

name: Build and Push Docker Images
on:
push:
branches:
- 'main'
tags:
- 'v*'
pull_request:
branches:
- 'main'
jobs:
build_backend:
name: Build and Push Backend
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v3
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
with:
images: linea/orchestration
tags: |
type=raw,enable=${{ startsWith(github.ref, 'refs/tags/v') }},priority=100,prefix=backend_,value=latest
type=semver,enable=true,priority=200,prefix=backend_v,suffix=,pattern={{version}}
type=sha,enable=true,priority=300,prefix=backend_,suffix=,format=short
type=raw,priority=400,prefix=backend_dev_,value=latest
flavor: |
latest=false
- name: Log in to Docker Hub
if: github.event_name != 'pull_request'
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Build and push Docker image
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
with:
context: ./backend
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
# build-args: |
# USERNAME=${{ secrets.PZ_USERNAME }}
# USERID=${{ secrets.PZ_USERID }}
# GROUPID=${{ secrets.PZ_GROUPID }}