Skip to content

Commit 1ccc398

Browse files
committed
Set short tag
1 parent 8a89d7a commit 1ccc398

File tree

4 files changed

+15
-7
lines changed

4 files changed

+15
-7
lines changed

.github/workflows/docker.yml renamed to .github/workflows/docker-registry-publish.yml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
name: Publish Docker image
22
on:
33
push:
4-
branches:
5-
- main
4+
65
jobs:
76
push_docker:
87
name: Push Ubuntu Docker image to Docker Hub
98
runs-on: ubuntu-latest
109
steps:
1110
- name: Check out the repo
1211
uses: actions/checkout@v2
12+
- run: echo "GIT_SHORT_SHA=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
1313
- name: Login to DockerHub
1414
uses: docker/login-action@v1
1515
with:
@@ -19,7 +19,7 @@ jobs:
1919
uses: docker/build-push-action@v2
2020
with:
2121
file: ./Dockerfile.docker
22-
tags: msyea/ubuntu-docker
22+
tags: msyea/ubuntu-docker:$GIT_SHORT_SHA
2323
push: true
2424
push_dind:
2525
needs: push_docker
@@ -28,6 +28,7 @@ jobs:
2828
steps:
2929
- name: Check out the repo
3030
uses: actions/checkout@v2
31+
- run: echo "GIT_SHORT_SHA=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
3132
- name: Login to DockerHub
3233
uses: docker/login-action@v1
3334
with:
@@ -37,15 +38,17 @@ jobs:
3738
uses: docker/build-push-action@v2
3839
with:
3940
file: ./Dockerfile.dind
40-
tags: msyea/ubuntu-dind
41+
tags: msyea/ubuntu-dind:$GIT_SHORT_SHA
4142
push: true
43+
build-args: TAG=$GIT_SHORT_SHA
4244
push_gha:
4345
needs: [push_docker, push_dind]
4446
name: Push GitHub Actions runner image to Docker Hub
4547
runs-on: ubuntu-latest
4648
steps:
4749
- name: Check out the repo
4850
uses: actions/checkout@v2
51+
- run: echo "GIT_SHORT_SHA=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
4952
- name: Login to DockerHub
5053
uses: docker/login-action@v1
5154
with:
@@ -54,5 +57,6 @@ jobs:
5457
- name: Push to Docker Hub
5558
uses: docker/build-push-action@v2
5659
with:
57-
tags: msyea/github-actions-runner
60+
tags: msyea/github-actions-runner:$GIT_SHORT_SHA
5861
push: true
62+
build-args: TAG=$GIT_SHORT_SHA

.github/workflows/github.yml renamed to .github/workflows/github-packages-publish.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
name: Publish Docker image to GitHub
22
on:
33
push:
4+
branches:
5+
- main
46

57
jobs:
68
push_docker:

Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
ARG REGISTRY=msyea
2-
FROM ${REGISTRY}/ubuntu-dind
2+
ARG TAG=latest
3+
FROM ${REGISTRY}/ubuntu-dind:${TAG}
34

45
# "/run/user/UID" will be used by default as the value of XDG_RUNTIME_DIR
56
RUN mkdir /run/user && chmod 1777 /run/user

Dockerfile.dind

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
# PLEASE DO NOT EDIT IT DIRECTLY.
55
#
66
ARG REGISTRY=msyea
7-
FROM ${REGISTRY}/ubuntu-docker
7+
ARG TAG=latest
8+
FROM ${REGISTRY}/ubuntu-docker:${TAG}
89

910
# https://github.com/docker/docker/blob/master/project/PACKAGERS.md#runtime-dependencies
1011
ENV DEBIAN_FRONTEND=noninteractive

0 commit comments

Comments
 (0)