Spaces:
Sleeping
Sleeping
Update docker-image.yml
Browse files
.github/workflows/docker-image.yml
CHANGED
@@ -1,26 +1,41 @@
|
|
1 |
-
name: Docker
|
2 |
|
3 |
on:
|
4 |
push:
|
5 |
-
branches: [
|
6 |
-
pull_request:
|
7 |
-
branches: [ "main" ]
|
8 |
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
|
|
|
|
|
13 |
runs-on: ubuntu-latest
|
|
|
|
|
|
|
14 |
|
15 |
steps:
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
|
18 |
steps:
|
19 |
+
- name: Checkout repository
|
20 |
+
uses: actions/checkout@v3
|
21 |
+
|
22 |
+
- name: Log in to the Container registry
|
23 |
+
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
|
24 |
+
with:
|
25 |
+
registry: ${{ env.REGISTRY }}
|
26 |
+
username: ${{ github.actor }}
|
27 |
+
password: ${{ secrets.PUBLISH_TOKEN }}
|
28 |
+
|
29 |
+
- name: Extract metadata (tags, labels) for Docker
|
30 |
+
id: meta
|
31 |
+
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
|
32 |
+
with:
|
33 |
+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
34 |
+
|
35 |
+
- name: Build and push Docker image
|
36 |
+
uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4
|
37 |
+
with:
|
38 |
+
context: .
|
39 |
+
push: true
|
40 |
+
tags: ${{ steps.meta.outputs.tags }}
|
41 |
+
labels: ${{ steps.meta.outputs.labels }}
|