forked from Lomray-Software/vite-ssr-boost
-
Notifications
You must be signed in to change notification settings - Fork 0
86 lines (78 loc) · 2.25 KB
/
ssr-boost-docker-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: SSR BOOST Docker build
on:
workflow_call:
inputs:
registry:
required: true
type: string
image-name:
required: true
type: string
version:
required: true
type: string
app-build-path:
required: true
type: string
should-skip-artifacts:
required: false
type: boolean
default: false
should-checkout:
required: false
type: boolean
default: false
secrets:
github-token:
required: true
extra-build-args:
required: false
outputs:
image-tag:
description: "Docker image with new tag version"
value: ${{ jobs.docker-build.outputs.image-tag }}
jobs:
docker-build:
runs-on: ubuntu-latest
concurrency:
group: ${{ github.ref }}-build-docker
cancel-in-progress: true
outputs:
# get docker image tag with version
image-tag: ${{ fromJSON(steps.meta.outputs.json).tags[0] }}
steps:
- uses: actions/checkout@v4
if: ${{ inputs.should-checkout }}
- uses: actions/download-artifact@v4
if: ${{ !inputs.should-skip-artifacts }}
with:
name: build-artifact
- name: Setup Docker buildx
uses: docker/setup-buildx-action@v3
- name: Log into registry
uses: docker/login-action@v3
with:
registry: ${{ inputs.registry }}
username: ${{ github.actor }}
password: ${{ secrets.github-token }}
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v5
with:
images: "${{ inputs.registry }}/${{ inputs.image-name }}"
tags: |
type=raw,prefix={{branch}}-,value=${{ inputs.version }}
type=raw,prefix=latest-,value={{branch}}
- name: Build and push Docker image
id: build-and-push
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
build-args: |
BUILD_PATH=${{ inputs.app-build-path }}
${{ secrets.extra-build-args }}