-
Notifications
You must be signed in to change notification settings - Fork 68
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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
- Loading branch information
Showing
3 changed files
with
101 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
name: Build and release DockerHub image | ||
on: | ||
workflow_dispatch: | ||
inputs: | ||
version: | ||
description: The complete version to tag the release with, e.g., 1.2.0, 1.2.1-alpha.1 | ||
required: true | ||
major_version: | ||
description: The major version to tag the release with, e.g., 2.x, 3.x | ||
required: true | ||
|
||
jobs: | ||
build_publish_DockerHub_image: | ||
name: Build X-Ray daemon docker image with amazonlinux base & release to DockerHub | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout Repository | ||
uses: actions/checkout@v2 | ||
|
||
- name: Setup Go | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: '^1.16' | ||
|
||
- uses: actions/cache@v2 | ||
with: | ||
path: ~/go/pkg/mod | ||
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | ||
restore-keys: | | ||
${{ runner.os }}-go- | ||
- name: Build and test | ||
run: make build test | ||
env: | ||
VERSION: ${{ github.event.inputs.version }} | ||
|
||
- name: Login to DockerHub | ||
uses: docker/login-action@v1 | ||
with: | ||
username: ${{ secrets.DOCKER_USER }} | ||
password: ${{ secrets.DOCKER_PASS }} | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v1 | ||
|
||
- name: Cache Docker layers | ||
uses: actions/cache@v2 | ||
with: | ||
path: /tmp/.buildx-cache | ||
key: ${{ runner.os }}-buildx-${{ github.sha }} | ||
restore-keys: | | ||
${{ runner.os }}-buildx- | ||
- name: Build docker image | ||
uses: docker/build-push-action@v2 | ||
with: | ||
context: . | ||
file: ./Dockerfile.amazonlinux | ||
platforms: linux/amd64,linux/arm64 | ||
tags: | | ||
amazon/aws-xray-daemon:${{ github.event.inputs.version }} | ||
amazon/aws-xray-daemon:latest | ||
amazon/aws-xray-daemon:${{ github.event.inputs.major_version }} | ||
push: true | ||
cache-from: type=local,src=/tmp/.buildx-cache | ||
cache-to: type=local,dest=/tmp/.buildx-cache |