Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Workflow - Publish DockerHub image built on amazonlinux #132

Merged
merged 7 commits into from
Apr 16, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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