Skip to content

v3.7.2

v3.7.2 #87

Workflow file for this run

# This workflow will perform the following actions when a release is published:
# - Fetch latest release information
# - Build and push full Docker image with release version tags
# - Build and push lite Docker image with proxy settings and release version tags
# - Build and push frontend Docker image (only if frontend files changed)
# - Push all images to Docker Hub with proper tagging
#
# Maintainers:
# - name: Nisha Sharma
# - email: nisha.sharma@uni-jena.de
name: Prod Build, Test and Publish
on:
release:
types: [published]
# Set global environment variables
env:
REPOSITORY_NAME: cheminformatics-microservice
REPOSITORY_NAMESPACE: nfdi4chem
jobs:
push_to_registry:
# Job to build and push Docker images
name: Push Docker images to Docker Hub
runs-on: ubuntu-latest
steps:
# Checkout code
- name: Check out the repo
uses: actions/checkout@v4
# Set up Docker Buildx
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
# Docker Hub login
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
# Build and push backend image
- name: Build and push full Docker image
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile
push: true
build-args: |
RELEASE_VERSION=${{ github.event.release.tag_name }}
tags: |
${{ env.REPOSITORY_NAMESPACE }}/${{ env.REPOSITORY_NAME }}:${{ github.event.release.tag_name }}
${{ env.REPOSITORY_NAMESPACE }}/${{ env.REPOSITORY_NAME }}:latest
cache-from: type=gha
cache-to: type=gha,mode=max
# Build and push lite version of backend image
- name: Build and push lite Docker image
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile.lite
push: true
build-args: |
RELEASE_VERSION=${{ github.event.release.tag_name }}
tags: |
${{ env.REPOSITORY_NAMESPACE }}/${{ env.REPOSITORY_NAME }}:${{ github.event.release.tag_name }}-lite
${{ env.REPOSITORY_NAMESPACE }}/${{ env.REPOSITORY_NAME }}:latest-lite
cache-from: type=gha
cache-to: type=gha,mode=max
# Check if frontend files have changed to optimize build process
- name: Check for frontend changes
uses: dorny/paths-filter@v2
id: frontend-changes
with:
filters: |
frontend:
- 'frontend/**'
# Build frontend Docker image only if frontend files changed
- name: Build and push frontend Docker image
uses: docker/build-push-action@v5
with:
context: ./frontend
file: ./frontend/Dockerfile
push: true
build-args: |
REACT_APP_API_URL=https://api.naturalproducts.net/latest
tags: |
${{ env.REPOSITORY_NAMESPACE }}/${{ env.REPOSITORY_NAME }}:app-${{ github.event.release.tag_name }}
${{ env.REPOSITORY_NAMESPACE }}/${{ env.REPOSITORY_NAME }}:app
cache-from: type=gha
cache-to: type=gha,mode=max