Skip to content

Build and Push Docker Image Manually(Full Package) #33

Build and Push Docker Image Manually(Full Package)

Build and Push Docker Image Manually(Full Package) #33

name: Build and Push Docker Image Manually(Full Package)
on:
workflow_run:
workflows: ["Build and Push Docker Image Manually(Core)"]
types:
- completed
jobs:
build-and-push-image:
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
with:
images: |
statgarten/dockerImage
- name: Set TAG env
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- name: Metadata
run: echo "container tag will be 'lastest' and '${{ env.RELEASE_VERSION }}'"
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to DockerHub/
uses: docker/#-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Login to GitHub Container Registry
uses: docker/#-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GHCR_TOKEN }}
- name: Build and push
id: docker_build
uses: docker/build-push-action@v2
with:
push: true
tags: |
dao0312/statgarten:latest
dao0312/statgarten:${{ env.RELEASE_VERSION }}
ghcr.io/${{ github.repository_owner }}/statgarten:latest
ghcr.io/${{ github.repository_owner }}/statgarten:${{ env.RELEASE_VERSION }}