Skip to content

Commit 1ec1582

Browse files
committed
adedd workflows
1 parent 7d30bc3 commit 1ec1582

File tree

2 files changed

+78
-0
lines changed

2 files changed

+78
-0
lines changed

.github/workflows/dockerhub.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Publish Docker image
2+
3+
on:
4+
push:
5+
branches: ['main']
6+
7+
env:
8+
NAMESPACE: ${{ secrets.DOCKERHUB_NAMESPACE }}
9+
IMAGE_NAME: ${{ github.event.repository.name }}
10+
11+
jobs:
12+
push_to_registry:
13+
name: Push Docker image to Docker Hub
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Check out the repo
17+
uses: actions/checkout@v4
18+
19+
- name: Log in to Docker Hub
20+
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a
21+
with:
22+
username: ${{ secrets.DOCKER_USERNAME }}
23+
password: ${{ secrets.DOCKER_PASSWORD }}
24+
25+
- name: Extract metadata (tags, labels) for Docker
26+
id: meta
27+
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
28+
with:
29+
images: ${{ env.NAMESPACE }}/${{ env.IMAGE_NAME }}
30+
31+
- name: Build and push Docker image
32+
uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671
33+
with:
34+
context: .
35+
file: ./Dockerfile
36+
push: true
37+
tags: ${{ steps.meta.outputs.tags }}
38+
labels: ${{ steps.meta.outputs.labels }}

.github/workflows/ghrc.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Create and publish a Docker image
2+
3+
on:
4+
push:
5+
branches: ['main']
6+
7+
env:
8+
REGISTRY: ghcr.io
9+
IMAGE_NAME: ${{ github.repository }}
10+
11+
jobs:
12+
build-and-push-image:
13+
runs-on: ubuntu-latest
14+
permissions:
15+
contents: read
16+
packages: write
17+
steps:
18+
- name: Checkout repository
19+
uses: actions/checkout@v4
20+
21+
- name: Log in to the Container registry
22+
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
23+
with:
24+
registry: ${{ env.REGISTRY }}
25+
username: ${{ github.actor }}
26+
password: ${{ secrets.TOKEN }}
27+
28+
- name: Extract metadata (tags, labels) for Docker
29+
id: meta
30+
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
31+
with:
32+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
33+
34+
- name: Build and push Docker image
35+
uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4
36+
with:
37+
context: .
38+
push: true
39+
tags: ${{ steps.meta.outputs.tags }}
40+
labels: ${{ steps.meta.outputs.labels }}

0 commit comments

Comments
 (0)