-
Notifications
You must be signed in to change notification settings - Fork 0
59 lines (49 loc) · 1.27 KB
/
docker-test.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
# Candace Savonen Apr 2022
name: Build Docker Image
on:
workflow_call:
inputs:
directory:
required: true
type: string
tag:
required: true
type: string
dockerhubpush:
description: 'Push to Dockerhub?'
required: false
default: 'false'
type: string
secrets:
GH_PAT:
required: true
DOCKERHUB_USERNAME:
required: false
DOCKERHUB_TOKEN:
required: false
defaults:
run:
working-directory: ./
jobs:
build-docker:
name: Build Docker image
runs-on: ubuntu-latest
steps:
- name: checkout repo
uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
if: ${{ inputs.dockerhubpush != 'false' }}
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build
uses: docker/build-push-action@v6
with:
push: ${{ inputs.dockerhubpush }}
context: ${{ inputs.directory }}
file: ${{ inputs.directory }}/Dockerfile
platforms: linux/amd64
tags: ${{ inputs.tag }}