Skip to content

feat: update alpine and golang version. update CI #24

feat: update alpine and golang version. update CI

feat: update alpine and golang version. update CI #24

name: Build Docker Image
on:
push:
tags:
- 'v*'
pull_request:
types: [opened, reopened, synchronize]
env:
IMAGE_BASE_NAME: "ghcr.io/${{ github.repository_owner }}/go-base"
jobs:
build-sharedlib-image:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
# list of Docker images to use as base name for tags
images: name=${{env.IMAGE_BASE_NAME}}
# generate Docker tags based on the following events/attributes
tags: |
type=ref,event=tag
type=semver,pattern={{raw}}
type=sha
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GHCR
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ secrets.CR_USER_NAME }}
password: ${{ secrets.CR_PAT }}
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
file: ./sharedlib.dockerfile
platforms: linux/amd64,linux/arm64
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-staticlib-image:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
# list of Docker images to use as base name for tags
images: name=${{env.IMAGE_BASE_NAME}}
# generate Docker tags based on the following events/attributes
flavor: |
latest=auto
suffix=-static,onlatest=true
tags: |
type=ref,event=tag,suffix=-static
type=semver,pattern={{raw}},suffix=-static
type=sha,suffix=-static
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GHCR
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ secrets.CR_USER_NAME }}
password: ${{ secrets.CR_PAT }}
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
file: ./staticlib.dockerfile
platforms: linux/amd64,linux/arm64
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}