Repository navigation
70 lines (59 loc) · 1.83 KB
/
Copy pathdockerimage.yml
File metadata and controls
70 lines (59 loc) · 1.83 KB
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
name: Docker Image CI
on:
push:
branches: [ master ]
paths-ignore:
- '.github/**'
pull_request:
branches: [ master ]
paths-ignore:
- '.github/**'
workflow_dispatch: {}
jobs:
build:
runs-on: ubuntu-latest
env:
DOCKER_BUILDKIT: 1
image: webnut
steps:
- name: checkout
uses: actions/checkout@v7
continue-on-error: true
- id: hado
name: hadolint
uses: hadolint/hadolint-action@v3.5.0
with:
dockerfile: Dockerfile
config: .hadolint.yml
continue-on-error: true
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v4
with:
version: latest
use: true
- name: Setup QEMU (multi-arch)
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
uses: docker/setup-qemu-action@v4
with:
platforms: all
- name: Builder instance name
run: echo ${{ steps.buildx.outputs.name }}
- name: Available platforms
run: echo ${{ steps.buildx.outputs.platforms }}
- name: Login to Docker hub
uses: docker/login-action@v4
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build multi platforms and push
uses: docker/build-push-action@v7
with:
builder: ${{ steps.buildx.outputs.name }}
context: .
file: ./Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ secrets.DOCKER_USERNAME }}/${{ env.image }}:latest
cache-from: type=registry,ref=${{ secrets.DOCKER_USERNAME }}/${{ env.image }}:buildcache
cache-to: type=registry,ref=${{ secrets.DOCKER_USERNAME }}/${{ env.image }}:buildcache,mode=max