Skip to content

Commit

Permalink
Workflow - Publish DockerHub image built on amazonlinux (#132)
Browse files Browse the repository at this point in the history
* Adding separate workflow for dockerhub

* adding build step

* Splitting ECR and DockerHub images step

* Updating continuous build wf as well
  • Loading branch information
srprash authored Apr 16, 2021
1 parent ed46c4c commit 118ce43
Show file tree
Hide file tree
Showing 3 changed files with 101 additions and 6 deletions.
17 changes: 15 additions & 2 deletions .github/workflows/continuous-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -123,15 +123,28 @@ jobs:
restore-keys: |
${{ runner.os }}-buildx-
- name: Build docker image
- name: Build docker image for public ECR
if: ${{ runner.os == 'Linux' }}
uses: docker/build-push-action@v2
with:
context: .
file: ./Dockerfile
push: ${{ github.event_name == 'push' }}
platforms: linux/amd64,linux/arm64
tags: |
amazon/aws-xray-daemon:alpha
public.ecr.aws/xray/aws-xray-daemon:alpha
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache

- name: Build docker image for DockerHub
if: ${{ runner.os == 'Linux' }}
uses: docker/build-push-action@v2
with:
context: .
file: ./Dockerfile.amazonlinux
push: ${{ github.event_name == 'push' }}
platforms: linux/amd64,linux/arm64
tags: |
amazon/aws-xray-daemon:alpha
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache
24 changes: 20 additions & 4 deletions .github/workflows/release-build-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ on:
version:
description: The 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., 1.x, 2.x, 3.x
required: true

jobs:
build_publish_daemon_image:
Expand Down Expand Up @@ -93,17 +96,30 @@ jobs:
restore-keys: |
${{ runner.os }}-buildx-
- name: Build docker image
- name: Build docker image for Public ECR
uses: docker/build-push-action@v2
with:
context: .
file: ./Dockerfile
platforms: linux/amd64,linux/arm64
tags: |
amazon/aws-xray-daemon:${{ github.event.inputs.version }}
amazon/aws-xray-daemon:latest
amazon/aws-xray-daemon:3.x
public.ecr.aws/xray/aws-xray-daemon:${{ github.event.inputs.version }}
public.ecr.aws/xray/aws-xray-daemon:latest
public.ecr.aws/xray/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

- name: Build docker image for DockerHub
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
Expand Down
66 changes: 66 additions & 0 deletions .github/workflows/release-publish-Dockerhub.yml
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

0 comments on commit 118ce43

Please sign in to comment.