Skip to content

πŸš€ adjust build-package flow #25

πŸš€ adjust build-package flow

πŸš€ adjust build-package flow #25

name: Build & push vMonitor-Metrics-Agent Docker Image
on: push
env:
VERSION: 1.26.0-1.0.2
jobs:
build:
name: Build & push docker image
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/[email protected]
# - name: Create image name env
# run: |
# echo "IMG_NAME=${{ vars.DOCKERHUB_USERNAME }}/${{ env.REPO_NAME }}" >> $GITHUB_ENV
# - name: debug
# run: |
# echo ${{ env.IMG_NAME }}
# - name: Docker metadata
# id: metadata
# uses: docker/metadata-action@v4
# with:
# images: |
# ${{ env.IMG_NAME }}
# tags: |
# type=semver,pattern={{version}}
# type=semver,pattern={{major}}.{{minor}}
# type=raw,value={{sha}},enable=${{ github.ref_type != 'tag' }}
- name: Log in to the GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push Docker image
uses: docker/build-push-action@v4
with:
build-args: |
ARG_VERSION=${{ env.VERSION }}
ARG_GITHUB_REPOSITORY=${{ github.repository }}
context: ./docker
push: true
tags: |
ghcr.io/${{ github.repository_owner }}/telegraf:${{ env.VERSION }}
ghcr.io/${{ github.repository_owner }}/telegraf:${{ github.sha }}
labels: ${{ steps.metadata.outputs.labels }}
# build-alpine:
# name: Build & push docker image Alpine
# runs-on: ubuntu-20.04
# steps:
# - name: Checkout repository
# uses: actions/[email protected]
# - name: Create image name env
# run: |
# echo "IMG_NAME=${{ vars.DOCKERHUB_USERNAME }}/${{ env.REPO_NAME }}" >> $GITHUB_ENV
# - name: debug
# run: |
# echo ${{ env.IMG_NAME }}
# - name: Docker metadata
# id: metadata
# uses: docker/metadata-action@v4
# with:
# images: |
# ${{ env.IMG_NAME }}
# tags: |
# type=semver,pattern={{version}},suffix=-alpine
# type=semver,pattern={{major}}.{{minor}},suffix=-alpine
# type=raw,value={{sha}}-alpine,enable=${{ github.ref_type != 'tag' }}
# - name: Login to Docker Hub
# uses: docker/login-action@v2
# with:
# username: ${{ vars.DOCKERHUB_USERNAME }}
# password: ${{ secrets.DOCKERHUB_TOKEN }}
# - name: Build and push Docker image
# uses: docker/build-push-action@v4
# with:
# context: ./docker/alpine
# push: ${{ inputs.push_to_hub }}
# tags: ${{ steps.metadata.outputs.tags }}
# labels: ${{ steps.metadata.outputs.labels }}