Build Gladys dev images #216
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: Build Gladys dev images | |
on: | |
workflow_dispatch: | |
inputs: | |
tag: | |
description: 'Docker Tag to build' | |
required: true | |
default: 'dev' | |
platforms: | |
description: 'Docker platform to build' | |
required: true | |
default: 'linux/amd64,linux/arm64/v8' | |
jobs: | |
build-front: | |
name: Front build | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: ⬇️ Checkout code | |
uses: actions/checkout@v3 | |
- name: 💽 Setup nodejs | |
uses: actions/setup-node@v3 | |
with: | |
node-version-file: 'front/package.json' | |
cache: 'npm' | |
cache-dependency-path: '**/package-lock.json' | |
- name: 📦 Install NPM front packages | |
working-directory: ./front | |
run: | | |
npm ci | |
- name: 🏗️ Build front | |
working-directory: ./front | |
run: | | |
npm run build | |
- name: ↗️ Upload build artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: static | |
path: front/build | |
docker: | |
needs: build-front | |
name: Docker magic ! | |
runs-on: ubuntu-22.04 | |
env: | |
DOCKERHUB_USER: ${{secrets.DOCKERHUB_USER}} | |
DOCKERHUB_PASSWORD: ${{secrets.DOCKERHUB_PASSWORD}} | |
DOCKERHUB_REPO: ${{secrets.DOCKERHUB_REPO}} | |
steps: | |
- name: ⬇️ Checkout code | |
uses: actions/checkout@v3 | |
- name: 🐳 Docker meta | |
id: docker_meta | |
uses: docker/metadata-action@v4 | |
with: | |
images: ${{ secrets.DOCKERHUB_REPO }} | |
labels: | | |
org.opencontainers.image.title=Gladys Assistant Preprod Image | |
- name: 💽 Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- name: 🐳 Set up Docker Buildx | |
id: buildx | |
uses: docker/setup-buildx-action@v2 | |
with: | |
version: latest | |
- name: ↙️ Download build artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: static | |
path: static | |
- name: 🔑 Login to DockerHub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKERHUB_USER }} | |
password: ${{ secrets.DOCKERHUB_PASSWORD }} | |
- name: 🐳 Build and push | |
uses: docker/build-push-action@v3 | |
with: | |
context: . | |
file: ./docker/Dockerfile.buildx | |
platforms: ${{ github.event.inputs.platforms }} | |
push: true | |
pull: true | |
tags: ${{ secrets.DOCKERHUB_REPO }}:${{ github.event.inputs.tag }} | |
cache-from: type=registry,ref=${{ secrets.DOCKERHUB_REPO }}:${{ github.event.inputs.tag }} | |
cache-to: type=inline |