Skip to content

Merge pull request #246 from linea-it/241-new-card-for-pz-compute #373

Merge pull request #246 from linea-it/241-new-card-for-pz-compute

Merge pull request #246 from linea-it/241-new-card-for-pz-compute #373

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/pzserver
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 }}
build_frontend:
name: Build and Push Frontend
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/pzserver
tags: |
type=raw,enable=${{ startsWith(github.ref, 'refs/tags/v') }},priority=100,prefix=frontend_,value=latest
type=semver,enable=true,priority=200,prefix=frontend_v,suffix=,pattern={{version}}
type=sha,enable=true,priority=300,prefix=frontend_,suffix=,format=short
type=raw,priority=400,prefix=frontend_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: 'Create env file'
run: |
touch ./frontend/.env
echo NEXT_PUBLIC_CLIENT_ID=${{ secrets.DJANGO_CLIENT_ID }} >> ./frontend/.env
echo NEXT_PUBLIC_CLIENT_SECRET=${{ secrets.DJANGO_SECRET }} >> ./frontend/.env
cat ./frontend/.env
- name: Build and push Docker image
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
with:
context: ./frontend
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
USERID=${{ secrets.PZ_USERID }}
GROUPID=${{ secrets.PZ_GROUPID }}