Skip to content

fix:remove build arg from prod-build.yml #83

fix:remove build arg from prod-build.yml

fix:remove build arg from prod-build.yml #83

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]
on:
push:
branches:
- dev-nisha
# Set global environment variables
env:
DOCKER_HUB_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_HUB_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
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
# Fetch latest GitHub release
- name: Fetch latest release
id: fetch-latest-release
uses: InsonusK/get-latest-release@v1.0.1
with:
myToken: ${{ github.token }}
exclude_types: "draft"
view_top: 10
# Docker Hub login
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ env.DOCKER_HUB_USERNAME }}
password: ${{ env.DOCKER_HUB_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=${{ steps.fetch-latest-release.outputs.tag_name }}
# tags: |
# ${{ env.REPOSITORY_NAMESPACE }}/${{ env.REPOSITORY_NAME }}:${{ steps.fetch-latest-release.outputs.tag_name }}
# ${{ env.REPOSITORY_NAMESPACE }}/${{ env.REPOSITORY_NAME }}:latest
# # 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=${{ steps.fetch-latest-release.outputs.tag_name }}
tags: |
${{ env.REPOSITORY_NAMESPACE }}/${{ env.REPOSITORY_NAME }}:${{ steps.fetch-latest-release.outputs.tag_name }}-lite
${{ env.REPOSITORY_NAMESPACE }}/${{ env.REPOSITORY_NAME }}:latest-lite
# 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-${{ steps.fetch-latest-release.outputs.tag_name }}
${{ env.REPOSITORY_NAMESPACE }}/${{ env.REPOSITORY_NAME }}:app