Update Docker image build and push steps #9
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: Docker Image CI | |
on: | |
push: | |
branches: ["main"] | |
pull_request: | |
branches: ["main"] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Build the Docker image | |
run: docker build . --file Dockerfile --tag kode-pos:$(date +%s) | |
- name: Log in to Docker Hub | |
run: echo ${{ secrets.CR_PAT }} | docker login ghcr.io -u Ashaffah --password-stdin | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7 | |
with: | |
images: ashaffah/kode-pos | |
- name: Push Docker image | |
# uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671 | |
run: docker push ghcr.io/ashaffah/kode-pos:latest | |
# with: | |
# context: . | |
# file: ./Dockerfile | |
# push: true | |
# tags: ${{ steps.meta.outputs.tags }} | |
# labels: ${{ steps.meta.outputs.labels }} |