Skip to content

Commit f2b0693

Browse files
authored
Merge pull request ilteoood#4 from jlesage/multi-tags
Added support for multiple tags.
2 parents 468c74a + 4462c15 commit f2b0693

File tree

4 files changed

+14
-4
lines changed

4 files changed

+14
-4
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ The accepted inputs are:
77

88
| Name | Type | Default | Mandatory | Description |
99
|---------------|-----------|-----------|-------------|-----------------------------------------------------------------|
10-
| `tag` | String | `latest` | No | Tag to apply to the image |
10+
| `tag` | String | `latest` | No | Tags (*comma separated*) to apply to the image |
1111
| `imageName` | String | | Yes | Name of the image |
1212
| `dockerFile` | String | `Dockerfile` | No | Name of the Dockerfile |
1313
| `publish` | Boolean | `false` | No | Indicate if the builded image should be published on Docker HUB |

action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ branding:
55
color: blue
66
inputs:
77
tag:
8-
description: "Tag to apply to the image"
8+
description: "Tags (comma separated) to apply to the image"
99
default: "latest"
1010
imageName:
1111
description: "Name of the image"

scripts/docker_build.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
11
#!/bin/sh -l
22
export DOCKER_CLI_EXPERIMENTAL=enabled
3-
docker buildx build --platform $1 -t $2:$3 -f $4 .
3+
DOCKER_BUILDX_TAG_OPTS=
4+
for TAG in $(echo "$3" | tr ',' ' ')
5+
do
6+
DOCKER_BUILDX_TAG_OPTS="$DOCKER_BUILDX_TAG_OPTS --tag $2:$TAG"
7+
done
8+
docker buildx build --platform $1 $DOCKER_BUILDX_TAG_OPTS -f $4 .

scripts/docker_build_push.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
11
#!/bin/sh -l
22
export DOCKER_CLI_EXPERIMENTAL=enabled
3-
docker buildx build --platform $1 --push -t $2:$3 -f $4 .
3+
DOCKER_BUILDX_TAG_OPTS=
4+
for TAG in $(echo "$3" | tr ',' ' ')
5+
do
6+
DOCKER_BUILDX_TAG_OPTS="$DOCKER_BUILDX_TAG_OPTS --tag $2:$TAG"
7+
done
8+
docker buildx build --platform $1 --push $DOCKER_BUILDX_TAG_OPTS -f $4 .

0 commit comments

Comments
 (0)