-
-
Notifications
You must be signed in to change notification settings - Fork 288
86 lines (84 loc) · 2.57 KB
/
docker-dev-build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
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