Skip to content

[SYSE-363 release-5-lts] May template application #3626

[SYSE-363 release-5-lts] May template application

[SYSE-363 release-5-lts] May template application #3626

---
name: Plugin-compiler build
on:
pull_request:
push:
tags:
- 'v*'
jobs:
docker-build:
strategy:
matrix:
golang_cross:
- 1.16-bullseye
- 1.16-el7
runs-on: ubuntu-latest
permissions:
id-token: write
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Configure AWS Credentials
id: configure-aws
uses: aws-actions/configure-aws-credentials@v2
with:
role-to-assume: arn:aws:iam::754489498669:role/ecr_rw_tyk
role-session-name: ci-plugin-compiler-push
aws-region: eu-central-1
- name: Login to AWS ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1
- name: Set docker metadata
id: set-metadata
uses: docker/metadata-action@v4
with:
images: |
tykio/tyk-plugin-compiler,enable=${{ startsWith(github.ref, 'refs/tags') }}
${{ steps.login-ecr.outputs.registry }}/tyk-plugin-compiler
labels: |
org.opencontainers.image.title=tyk-plugin-compiler
org.opencontainers.image.description=Plugin compiler for the Tyk API Gateway
tags: |
type=semver,pattern=v{{version}},enable=${{ !endsWith(matrix.golang_cross, 'el7') }}
type=semver,pattern=v{{major}}.{{minor}},enable=${{ !endsWith(matrix.golang_cross, 'el7') }}
type=semver,pattern={{raw}},enable=${{ !endsWith(matrix.golang_cross, 'el7') }}
type=raw,value=${{ github.sha }},enable=${{ !startsWith(github.ref, 'refs/tags') && !endsWith(matrix.golang_cross, 'el7') }}
type=semver,pattern=v{{version}},suffix=-el7,enable=${{ endsWith(matrix.golang_cross, 'el7') }}
type=semver,pattern=v{{major}}.{{minor}},suffix=-el7,enable=${{ endsWith(matrix.golang_cross, 'el7') }}
type=semver,pattern={{raw}},suffix=-el7,enable=${{ endsWith(matrix.golang_cross, 'el7') }}
type=raw,value=${{ github.sha }},suffix=-el7,enable=${{ !startsWith(github.ref, 'refs/tags') && endsWith(matrix.golang_cross, 'el7') }}
- name: Login to Dockerhub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and push to dockerhub/ECR
uses: docker/build-push-action@v4
with:
context: .
file: ci/images/plugin-compiler/Dockerfile
platforms: linux/amd64
push: true
labels: ${{ steps.set-metadata.outputs.labels }}
tags: ${{ steps.set-metadata.outputs.tags }}
build-args: |
BASE_IMAGE=tykio/golang-cross:${{ matrix.golang_cross }}
GITHUB_SHA=${{ github.sha }}
GITHUB_TAG=${{ github.ref_name }}