Skip to content

Commit 28d0bd9

Browse files
committed
2 parents 3e60c1c + f76c35e commit 28d0bd9

2 files changed

Lines changed: 55 additions & 0 deletions

File tree

.github/workflows/docker-image.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: Docker Image CI
2+
3+
on:
4+
push:
5+
branches: [ "main" ]
6+
pull_request:
7+
branches: [ "main" ]
8+
9+
jobs:
10+
11+
build:
12+
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- uses: actions/checkout@v4
17+
- name: Build the Docker image
18+
run: docker build . --file Dockerfile --tag my-image-name:$(date +%s)

.github/workflows/docker.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Publish Docker
2+
on:
3+
push:
4+
branches:
5+
- main
6+
paths-ignore:
7+
- '.*'
8+
- '**.md'
9+
10+
env:
11+
IMAGE_NAME: ${{ github.repository }}
12+
13+
jobs:
14+
publish:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Checkout
18+
uses: actions/checkout@v4
19+
- name: Extract metadata for Docker
20+
id: meta
21+
uses: docker/metadata-action@v5
22+
with:
23+
images: ghcr.io/${{ env.IMAGE_NAME }}
24+
- name: Login to GitHub Container Registry
25+
uses: docker/login-action@v3
26+
with:
27+
registry: ghcr.io
28+
username: ${{ github.actor }}
29+
password: ${{ secrets.GITHUB_TOKEN }}
30+
- name: Build and Push Docker image
31+
uses: docker/build-push-action@v6
32+
with:
33+
context: .
34+
file: Dockerfile
35+
push: true
36+
tags: ${{ steps.meta.outputs.tags }}
37+
labels: ${{ steps.meta.outputs.labels }}

0 commit comments

Comments
 (0)