-
Notifications
You must be signed in to change notification settings - Fork 113
57 lines (56 loc) · 1.55 KB
/
docker.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
name: Docker
on:
workflow_call:
inputs:
file:
required: true
type: string
tags:
type: string
load:
type: boolean
push:
type: boolean
platforms:
type: string
context:
type: string
default: .
outputs:
image:
value: ${{ jobs.docker.outputs.image }}
jobs:
docker:
runs-on: self-hosted
outputs:
image: ${{ steps.build.outputs.imageid }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up QEMU
if: inputs.platforms != ''
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to Docker Hub
if: inputs.push
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build ${{ inputs.push && 'and push' || '' }} ${{ inputs.tags }} Docker image
uses: docker/build-push-action@v3
id: build
with:
context: ${{ inputs.context }}
file: ${{ inputs.file }}
tags: ${{ inputs.tags }}
load: ${{ inputs.load }}
push: ${{ inputs.push }}
platforms: ${{ inputs.platforms }}
- name: Upload ${{ steps.build.outputs.imageid }} Docker image to artifacts
uses: ishworkh/docker-image-artifact-upload@v1
if: inputs.load
with:
image: ${{ steps.build.outputs.imageid }}
retention_days: '1'