Skip to content

Commit 03fcada

Browse files
committed
Push docker image to ghcr.io
1 parent 5ec0e29 commit 03fcada

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

.github/workflows/docker-image.yml

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,15 @@ jobs:
1111
build:
1212
runs-on: ubuntu-latest
1313
steps:
14-
- uses: actions/checkout@v4
15-
- name: Build the Docker image
16-
run: docker build . --file Dockerfile --tag ib-systems/openstack-peepo-exporter:$(date +%s)
14+
- name: Checkout code
15+
uses: actions/checkout@v4
16+
17+
- name: Log in to ghcr.io
18+
run: echo "${{ secrets.GHCR_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
19+
20+
- name: Build and tag image
21+
run: |
22+
COMMIT_SHA=$(echo $GITHUB_SHA | cut -c1-7)
23+
docker build -t ghcr.io/${{ github.repository_owner }}/${{ github.repository }}:$COMMIT_SHA .
24+
- name: Push image to GHCR
25+
run: docker push ghcr.io/${{ github.repository_owner }}/${{ github.repository }}:$COMMIT_SHA

0 commit comments

Comments
 (0)