-
Notifications
You must be signed in to change notification settings - Fork 607
53 lines (42 loc) · 1.36 KB
/
dockerhub-build-push.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
name: 🐳 Docker Hub Build & Push
on:
workflow_dispatch:
workflow_call:
permissions:
actions: write
checks: write
contents: write
pull-requests: write
packages: write
env:
NODE_VERSION: 20
jobs:
build-and-push-image:
runs-on: ubuntu-latest
steps:
- name: ⇣ Checkout
uses: actions/checkout@v4
with:
fetch-depth: 1
ref: ${{ github.event.pull_request.head.sha || github.ref }}
- name: 🏷️ Set Docker Image Tag
run: |
echo "PV=$(cat package.json | jq -r '.version')" >> $GITHUB_ENV
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: ⬢ Setup Node & Cache
uses: actions/setup-node@v4
with:
cache: "npm"
cache-dependency-path: package-lock.json
- name: ↧ Install
run: npm ci --verbose --foreground-scripts
- name: 🚢 Build Docker Builder
run: |
npm run --verbose --foreground-scripts init-docker-builder
- name: 🐳 Build & Push to Docker Hub
run: |
docker buildx build --push --platform linux/amd64,linux/arm64 -t backstopjs/backstopjs:$PV -t backstopjs/backstopjs:latest --build-arg BACKSTOPJS_VERSION=$PV docker