Feature/dashboard treatement #56
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Continuous Integration for UI Suivie Physique | |
on: | |
push: | |
branches: | |
- main | |
- dev | |
pull_request: | |
branches: | |
- main | |
- dev | |
workflow_dispatch: | |
jobs: | |
build-image: | |
name: Build Docker Image for UI Suivie Physique | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Extract project version | |
id: extract_version | |
run: | | |
cd frontend | |
echo "UI_VERSION=$(jq -r '.version' package.json )" >> $GITHUB_OUTPUT | |
- name: Setup Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to Dockerhub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKER_HUB_USERNAME }} | |
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} | |
- name: Setup Node.js environment | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '16' | |
- name: Cache Node Modules | |
uses: actions/cache@v2 | |
env: | |
cache-name: cache-node-modules | |
with: | |
path: frontend/node_modules | |
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-build-${{ env.cache-name }}-${{ runner.os }}-build-${{ runner.os }} | |
- name: Build Docker Image & Push to DockerHub | |
uses: docker/build-push-action@v5 | |
with: | |
context: frontend | |
file: docker/frontend/Dockerfile | |
push: true | |
platforms: linux/amd64,linux/arm64 | |
tags: dotcipher1/sp-ui:${{ steps.extract_version.outputs.UI_VERSION }}, dotcipher1/sp-ui:latest |