-
Notifications
You must be signed in to change notification settings - Fork 256
Expand file tree
/
Copy pathaction.yaml
More file actions
50 lines (46 loc) · 1.3 KB
/
action.yaml
File metadata and controls
50 lines (46 loc) · 1.3 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
name: Docker build action
description: Composite action for building Devito Docker containers
author: "Devito"
inputs:
# The only supported GHA input type is string
file:
description: "Dockerfile containing build instructions"
required: true
default: Dockerfile
tag:
description: "Tag to add to the built image"
required: true
base:
description: "Base docker image to build on top of"
default: ""
args:
description: "Arguments to pass to `docker build`"
required: true
default: ""
outputs:
unique:
description: "Unique identifier for the CI run"
value: ${{ steps.uniquetag.outputs.unique }}
runs:
using: "composite"
steps:
- id: uniquetag
name: "Generate unique CI tag"
shell: bash
run: |
UNIQUE=$(echo "${GITHUB_RUN_ID}_${GITHUB_RUN_ATTEMPT}" | cksum | cut -f 1 -d " ")
echo "Unique ID: ${UNIQUE}"
echo "unique=${UNIQUE}" >> "$GITHUB_OUTPUT"
- id: dockerbuild
name: "Build docker container"
shell: bash
env:
BASE: ${{ inputs.base }}
run: |
docker build \
--pull \
--file ${{ inputs.file }} \
--tag ${{ inputs.tag }}_${{ steps.uniquetag.outputs.unique }} \
${BASE:+--build-arg base=$BASE} \
${{ inputs.args }} \
.