Update default compose and readme #4
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and push Docker image to dockerhub | |
on: | |
push: | |
branches: [ "main" ] | |
tags: | |
- v** | |
env: | |
IMAGE_NAME: ${{ github.repository }} | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out the repo | |
uses: actions/checkout@v4 | |
- name: Login to dockerhub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Extract Docker metadata | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: ${{ env.IMAGE_NAME }} | |
- name: Build and Push Versioned Docker Image | |
id: build-and-push | |
uses: docker/build-push-action@v5 | |
if: ${{ github.ref != 'refs/heads/main' }} | |
with: | |
context: | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
- name: Build and Push Latest Docker Image | |
id: build-and-push-latest | |
uses: docker/build-push-action@v5 | |
if: ${{ github.ref == 'refs/heads/main' }} | |
with: | |
context: | |
push: true | |
tags: ${{ env.IMAGE_NAME }}:latest | |
labels: ${{ steps.meta.outputs.labels }} |