Skip to content

Push frontend image

Push frontend image #4

Workflow file for this run

name: Push frontend image
on:
workflow_dispatch:
inputs:
environment:
description: "Environment"
required: true
default: "staging"
jobs:
push_image:
runs-on: ubuntu-latest
environment: ${{ github.event.inputs.environment }}
env:
NEXT_PUBLIC_STAGE: staging
NEXT_PUBLIC_BACKEND_URL: ${{ vars.NEXT_PUBLIC_BACKEND_URL }}
NEXT_PUBLIC_URL: ${{ vars.NEXT_PUBLIC_URL }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: "18.13"
- name: Get version
id: package
run: echo "::set-output name=version::$(node -p "require('./front/package.json').version")"
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
file: ./front/Dockerfile
target: final
push: true
tags: |
${{ secrets.DOCKERHUB_USERNAME }}/composite-front:${{ steps.package.outputs.version }},
${{ secrets.DOCKERHUB_USERNAME }}/composite-front:latest
build-args: |
NPM_TOKEN=${{ secrets.NPM_TOKEN }}
NEXT_PUBLIC_STAGE=staging
NEXT_PUBLIC_BACKEND_URL=${{ vars.NEXT_PUBLIC_BACKEND_URL }}
NEXT_PUBLIC_URL=${{ vars.NEXT_PUBLIC_URL}}
INTERNAL_BACKEND_URL=${{ vars.INTERNAL_BACKEND_URL }}