-
Notifications
You must be signed in to change notification settings - Fork 22
77 lines (67 loc) · 2.05 KB
/
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
name: CI
on:
workflow_dispatch: {}
push:
branches:
- main
tags:
- "v*"
env:
REPO: "sealio"
BUILD_PLATFORMS: "linux/amd64,linux/arm64"
jobs:
skip:
timeout-minutes: 5
runs-on: ubuntu-22.04
permissions:
contents: read
pull-requests: read
actions: write
outputs:
should: ${{ steps.duplicate.outputs.should_skip }}
steps:
- name: Check Duplicate
id: duplicate
uses: fkirc/skip-duplicate-actions@v5
with:
github_token: "${{ github.token }}"
paths_ignore: '["**.md", "**.mdx", "**.png", "**.jpg"]'
do_not_skip: '["workflow_dispatch"]'
continue-on-error: true
build-and-push:
needs:
- skip
if: needs.skip.outputs.should != 'true'
runs-on: ubuntu-22.04
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Setup QEMU
uses: docker/setup-qemu-action@v2
with:
image: tonistiigi/binfmt:qemu-v7.0.0
platforms: "arm64"
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Get Docker Metadata
if: ${{ github.event_name != 'pull_request' }}
id: metadata
uses: docker/metadata-action@v4
with:
images: ${{ env.REPO }}/appilot
- name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.CI_DOCKERHUB_USERNAME }}
password: ${{ secrets.CI_DOCKERHUB_PASSWORD }}
- name: Build and push image
uses: docker/build-push-action@v4
with:
push: ${{ github.event_name != 'pull_request' }}
context: .
tags: ${{ steps.metadata.outputs.tags }}
platforms: ${{ env.BUILD_PLATFORMS }}
cache-from: |
type=registry,ref=${{ env.REPO }}/build-cache:appilot
cache-to: |
${{ github.event_name != 'pull_request' && format('type=registry,mode=max,oci-mediatypes=false,compression=gzip,ref={0}/build-cache:appilot,ignore-error=true', env.REPO) || '' }}