Skip to content

Commit 3ba157c

Browse files
authored
Push images
1 parent bd9d165 commit 3ba157c

1 file changed

Lines changed: 41 additions & 0 deletions

File tree

.github/workflows/docker-image.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ on:
99
jobs:
1010

1111
build:
12+
name: Build image
1213

1314
runs-on: ubuntu-latest
1415

@@ -18,3 +19,43 @@ jobs:
1819
run: echo "GITHUB_SHA_SHORT=`echo ${GITHUB_SHA} | cut -c1-8`" >> $GITHUB_ENV
1920
- name: Build the Docker image
2021
run: docker build . --file Dockerfile --tag openconceptlab/oclweb3:nightly --tag openconceptlab/oclweb3:3.0-alpha-${GITHUB_SHA_SHORT}
22+
23+
push_to_registries:
24+
name: Push images
25+
runs-on: ubuntu-latest
26+
permissions:
27+
packages: write
28+
contents: read
29+
steps:
30+
- name: Check out the repo
31+
uses: actions/checkout@v4
32+
33+
- name: Log in to Docker Hub
34+
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a
35+
with:
36+
username: ${{ secrets.DOCKER_USERNAME }}
37+
password: ${{ secrets.DOCKER_PASSWORD }}
38+
39+
- name: Log in to the Container registry
40+
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
41+
with:
42+
registry: ghcr.io
43+
username: ${{ github.actor }}
44+
password: ${{ secrets.GITHUB_TOKEN }}
45+
46+
- name: Extract metadata (tags, labels) for Docker
47+
id: meta
48+
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
49+
with:
50+
images: |
51+
my-docker-hub-namespace/my-docker-hub-repository
52+
ghcr.io/${{ github.repository }}
53+
54+
- name: Build and push Docker images
55+
uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671
56+
with:
57+
context: .
58+
push: true
59+
tags: ${{ steps.meta.outputs.tags }}
60+
labels: ${{ steps.meta.outputs.labels }}
61+

0 commit comments

Comments
 (0)