Skip to content

Commit

Permalink
added GHCR integration
Browse files Browse the repository at this point in the history
  • Loading branch information
Andriow committed Oct 31, 2024
1 parent 0c60838 commit f7f4276
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions .github/workflows/build-and-push.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Build Docker image
on:
push:
branches:
- main

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Log in to ghcr.io
run: echo "${{ secrets.GHCR_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin

- name: Build and tag image
run: |
COMMIT_SHA=$(echo $GITHUB_SHA | cut -c1-7)
docker build -t ghcr.io/${{ github.repository_owner }}/${{ github.repository }}:$COMMIT_SHA -f path/to/Dockerfile .
- name: Push image to GHCR
run: docker push ghcr.io/${{ github.repository_owner }}/${{ github.repository }}:$COMMIT_SHA

0 comments on commit f7f4276

Please sign in to comment.