Skip to content

Commit 11ee00b

Browse files
committed
Add README
1 parent 67255ac commit 11ee00b

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# docker-build-action
2+
This GitHub action will log into the specified Docker Registry and build 1 or 2 images based on the given config.
3+
4+
## Config
5+
`registry`: Registry's host
6+
`user`: Registry's user
7+
`password`: Registry user's password or token
8+
`image`: Docker image name without tag
9+
`tag`: Docker image tag
10+
`build_dev`: Creates a -dev image too if set to true

action.yml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ inputs:
1717
tag:
1818
description: "Docker image tag"
1919
required: true
20+
build_dev:
21+
description: 'Creates a -dev image too if set to true (default: "false")'
22+
required: true
23+
default: "false"
2024

2125
runs:
2226
using: "composite"
@@ -38,27 +42,30 @@ runs:
3842
images: ${{ inputs.image }}
3943

4044
- name: Build and push -dev image
45+
if: ${{ inputs.build_dev }} == "true"
4146
uses: docker/[email protected]
4247
with:
4348
context: ${{ github.workspace }}
44-
cache-from: ${{ inputs.image }}:${{ inputs.tag }}
4549
platforms: linux/amd64
4650
push: true
4751
build-args: |
4852
DEV=yes
4953
tags: |
5054
${{ inputs.image }}:${{ inputs.tag }}-dev
5155
labels: ${{ steps.meta.outputs.labels }}
56+
cache-from: type=gha
57+
cache-to: type=gha,mode=max
5258

5359
- name: Build and push prod image
5460
uses: docker/[email protected]
5561
with:
5662
context: ${{ github.workspace }}
57-
cache-from: ${{ inputs.image }}:${{ inputs.tag }}
5863
platforms: linux/amd64
5964
push: true
6065
build-args: |
6166
DEV=no
6267
tags: |
6368
${{ inputs.image }}:${{ inputs.tag }}
6469
labels: ${{ steps.meta.outputs.labels }}
70+
cache-from: type=gha
71+
cache-to: type=gha,mode=max

0 commit comments

Comments
 (0)