Spaces:
Build error
Build error
ReeInk
commited on
Commit
•
15b7cd6
1
Parent(s):
9d3b01a
feat: build docker image automatically
Browse files
.github/workflows/docker-image.yml
ADDED
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# https://docs.github.com/en/actions/publishing-packages/publishing-docker-images#publishing-images-to-github-packages
|
2 |
+
name: Create and publish a Docker image
|
3 |
+
|
4 |
+
on:
|
5 |
+
push:
|
6 |
+
branches:
|
7 |
+
- 'master'
|
8 |
+
tags:
|
9 |
+
- 'v*'
|
10 |
+
|
11 |
+
env:
|
12 |
+
REGISTRY: ghcr.io
|
13 |
+
IMAGE_NAME: ${{ github.repository }}
|
14 |
+
|
15 |
+
jobs:
|
16 |
+
build-and-push-image:
|
17 |
+
runs-on: ubuntu-latest
|
18 |
+
permissions:
|
19 |
+
contents: read
|
20 |
+
packages: write
|
21 |
+
|
22 |
+
steps:
|
23 |
+
- name: Checkout repository
|
24 |
+
uses: actions/checkout@v3
|
25 |
+
|
26 |
+
- name: Log in to the Container registry
|
27 |
+
uses: docker/login-action@v2
|
28 |
+
with:
|
29 |
+
registry: ${{ env.REGISTRY }}
|
30 |
+
username: ${{ github.actor }}
|
31 |
+
password: ${{ secrets.GITHUB_TOKEN }}
|
32 |
+
|
33 |
+
- name: Extract metadata (tags, labels) for Docker
|
34 |
+
id: meta
|
35 |
+
uses: docker/metadata-action@v4
|
36 |
+
with:
|
37 |
+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
38 |
+
|
39 |
+
- name: Build and push Docker image
|
40 |
+
uses: docker/build-push-action@v4
|
41 |
+
with:
|
42 |
+
context: .
|
43 |
+
push: true
|
44 |
+
tags: ${{ steps.meta.outputs.tags }}
|
45 |
+
labels: ${{ steps.meta.outputs.labels }}
|