Skip to content

Commit 01ef53c

Browse files
authored
Create docker.yml
1 parent 81e332f commit 01ef53c

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

.github/workflows/docker.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Build and Push Docker Image to GitHub Container Registry
2+
3+
on:
4+
push:
5+
branches:
6+
- main # Trigger on push to the main branch
7+
8+
jobs:
9+
build:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Checkout code
14+
uses: actions/checkout@v3
15+
16+
- name: Log in to GitHub Container Registry
17+
uses: docker/login-action@v2
18+
with:
19+
registry: ghcr.io
20+
username: ${{ github.actor }}
21+
password: ${{ secrets.GITHUB_TOKEN }}
22+
23+
- name: Build Docker image
24+
run: |
25+
docker build -t ghcr.io/${{ github.repository }}/wallpaper-ai:${{ github.sha }} .
26+
27+
- name: Push Docker image
28+
run: |
29+
docker push ghcr.io/${{ github.repository }}/wallpaper-ai:${{ github.sha }}
30+
31+
- name: Tag latest image
32+
run: |
33+
docker tag ghcr.io/${{ github.repository }}/wallpaper-ai:${{ github.sha }} ghcr.io/${{ github.repository }}/wallpaper-ai:latest
34+
35+
- name: Push the "latest" tag
36+
run: |
37+
docker push ghcr.io/${{ github.repository }}/wallpaper-ai:latest

0 commit comments

Comments
 (0)