Skip to content

Build and Publish Docker Image #7

Build and Publish Docker Image

Build and Publish Docker Image #7

Workflow file for this run

name: Publish Docker Image
on:
release:
types: [published]
env:
IMAGE_NAME: ghcr.io/jizi-network/ansible
jobs:
build:
name: Build and Push
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build Docker Image
run: |
docker build --tag ${{ env.IMAGE_NAME }}:latest \
--tag ${{ env.IMAGE_NAME }}:${{ github.ref_name }} .
- name: Push docker image
run: |
docker push ${{ env.IMAGE_NAME }}:latest
docker push ${{ env.IMAGE_NAME }}:${{ github.ref_name }}