Skip to content

Commit 118ce43

Browse files
authored
Workflow - Publish DockerHub image built on amazonlinux (#132)
* Adding separate workflow for dockerhub * adding build step * Splitting ECR and DockerHub images step * Updating continuous build wf as well
1 parent ed46c4c commit 118ce43

File tree

3 files changed

+101
-6
lines changed

3 files changed

+101
-6
lines changed

.github/workflows/continuous-build.yml

+15-2
Original file line numberDiff line numberDiff line change
@@ -123,15 +123,28 @@ jobs:
123123
restore-keys: |
124124
${{ runner.os }}-buildx-
125125
126-
- name: Build docker image
126+
- name: Build docker image for public ECR
127127
if: ${{ runner.os == 'Linux' }}
128128
uses: docker/build-push-action@v2
129129
with:
130130
context: .
131+
file: ./Dockerfile
131132
push: ${{ github.event_name == 'push' }}
132133
platforms: linux/amd64,linux/arm64
133134
tags: |
134-
amazon/aws-xray-daemon:alpha
135135
public.ecr.aws/xray/aws-xray-daemon:alpha
136136
cache-from: type=local,src=/tmp/.buildx-cache
137137
cache-to: type=local,dest=/tmp/.buildx-cache
138+
139+
- name: Build docker image for DockerHub
140+
if: ${{ runner.os == 'Linux' }}
141+
uses: docker/build-push-action@v2
142+
with:
143+
context: .
144+
file: ./Dockerfile.amazonlinux
145+
push: ${{ github.event_name == 'push' }}
146+
platforms: linux/amd64,linux/arm64
147+
tags: |
148+
amazon/aws-xray-daemon:alpha
149+
cache-from: type=local,src=/tmp/.buildx-cache
150+
cache-to: type=local,dest=/tmp/.buildx-cache

.github/workflows/release-build-publish.yml

+20-4
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ on:
55
version:
66
description: The version to tag the release with, e.g., 1.2.0, 1.2.1-alpha.1
77
required: true
8+
major_version:
9+
description: The major version to tag the release with, e.g., 1.x, 2.x, 3.x
10+
required: true
811

912
jobs:
1013
build_publish_daemon_image:
@@ -93,17 +96,30 @@ jobs:
9396
restore-keys: |
9497
${{ runner.os }}-buildx-
9598
96-
- name: Build docker image
99+
- name: Build docker image for Public ECR
97100
uses: docker/build-push-action@v2
98101
with:
99102
context: .
103+
file: ./Dockerfile
100104
platforms: linux/amd64,linux/arm64
101105
tags: |
102-
amazon/aws-xray-daemon:${{ github.event.inputs.version }}
103-
amazon/aws-xray-daemon:latest
104-
amazon/aws-xray-daemon:3.x
105106
public.ecr.aws/xray/aws-xray-daemon:${{ github.event.inputs.version }}
106107
public.ecr.aws/xray/aws-xray-daemon:latest
108+
public.ecr.aws/xray/aws-xray-daemon:${{ github.event.inputs.major_version }}
109+
push: true
110+
cache-from: type=local,src=/tmp/.buildx-cache
111+
cache-to: type=local,dest=/tmp/.buildx-cache
112+
113+
- name: Build docker image for DockerHub
114+
uses: docker/build-push-action@v2
115+
with:
116+
context: .
117+
file: ./Dockerfile.amazonlinux
118+
platforms: linux/amd64,linux/arm64
119+
tags: |
120+
amazon/aws-xray-daemon:${{ github.event.inputs.version }}
121+
amazon/aws-xray-daemon:latest
122+
amazon/aws-xray-daemon:${{ github.event.inputs.major_version }}
107123
push: true
108124
cache-from: type=local,src=/tmp/.buildx-cache
109125
cache-to: type=local,dest=/tmp/.buildx-cache
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: Build and release DockerHub image
2+
on:
3+
workflow_dispatch:
4+
inputs:
5+
version:
6+
description: The complete version to tag the release with, e.g., 1.2.0, 1.2.1-alpha.1
7+
required: true
8+
major_version:
9+
description: The major version to tag the release with, e.g., 2.x, 3.x
10+
required: true
11+
12+
jobs:
13+
build_publish_DockerHub_image:
14+
name: Build X-Ray daemon docker image with amazonlinux base & release to DockerHub
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Checkout Repository
18+
uses: actions/checkout@v2
19+
20+
- name: Setup Go
21+
uses: actions/setup-go@v2
22+
with:
23+
go-version: '^1.16'
24+
25+
- uses: actions/cache@v2
26+
with:
27+
path: ~/go/pkg/mod
28+
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
29+
restore-keys: |
30+
${{ runner.os }}-go-
31+
32+
- name: Build and test
33+
run: make build test
34+
env:
35+
VERSION: ${{ github.event.inputs.version }}
36+
37+
- name: Login to DockerHub
38+
uses: docker/login-action@v1
39+
with:
40+
username: ${{ secrets.DOCKER_USER }}
41+
password: ${{ secrets.DOCKER_PASS }}
42+
43+
- name: Set up Docker Buildx
44+
uses: docker/setup-buildx-action@v1
45+
46+
- name: Cache Docker layers
47+
uses: actions/cache@v2
48+
with:
49+
path: /tmp/.buildx-cache
50+
key: ${{ runner.os }}-buildx-${{ github.sha }}
51+
restore-keys: |
52+
${{ runner.os }}-buildx-
53+
54+
- name: Build docker image
55+
uses: docker/build-push-action@v2
56+
with:
57+
context: .
58+
file: ./Dockerfile.amazonlinux
59+
platforms: linux/amd64,linux/arm64
60+
tags: |
61+
amazon/aws-xray-daemon:${{ github.event.inputs.version }}
62+
amazon/aws-xray-daemon:latest
63+
amazon/aws-xray-daemon:${{ github.event.inputs.major_version }}
64+
push: true
65+
cache-from: type=local,src=/tmp/.buildx-cache
66+
cache-to: type=local,dest=/tmp/.buildx-cache

0 commit comments

Comments
 (0)