Skip to content

Commit 1194bf6

Browse files
authored
GitHub action (#13)
* Docker image action (#2) * Create docker-image.yml * update docker-image.yaml
1 parent d75524b commit 1194bf6

1 file changed

Lines changed: 45 additions & 0 deletions

File tree

.github/workflows/docker-image.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Docker Image CI
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
tags:
8+
- v*
9+
pull_request:
10+
11+
jobs:
12+
13+
build:
14+
15+
runs-on: ubuntu-latest
16+
env:
17+
REGISTRY: docker.io
18+
IMAGE_NAME: cloudrec/cloudrec
19+
20+
steps:
21+
- uses: actions/checkout@v4
22+
- name: Docker Login
23+
uses: docker/login-action@v3.4.0
24+
with:
25+
registry: ${{ env.REGISTRY }}
26+
username: ${{ secrets.DOCKER_USERNAME }}
27+
password: ${{ secrets.DOCKER_PASSWORD }}
28+
29+
- name: Extract Docker metadata
30+
id: meta
31+
uses: docker/metadata-action@v4
32+
with:
33+
images: ${{ env.IMAGE_NAME }}
34+
tags: |
35+
type=raw,value=latest,enable={{is_default_branch}}
36+
type=ref,enable=true,priority=600,prefix=,suffix=,event=tag
37+
38+
- name: Build and push Docker images
39+
uses: docker/build-push-action@v6.18.0
40+
with:
41+
context: .
42+
file: Dockerfile
43+
push: true
44+
tags: ${{ steps.meta.outputs.tags }}
45+
labels: ${{ steps.meta.outputs.labels }}

0 commit comments

Comments
 (0)