Repository navigation
153 lines (138 loc) · 5.32 KB
/
Copy pathdocker-image.yml
File metadata and controls
153 lines (138 loc) · 5.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
name: Build and Push Docker Images
on:
workflow_dispatch:
push:
branches: [ main ]
jobs:
# 后端与前端镜像并行构建,互不阻塞
backend:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Registry
uses: docker/login-action@v3
with:
registry: crpi-j9ha7sxwhatgtvj4.cn-shenzhen.personal.cr.aliyuncs.com
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Extract version from Directory.Packages.props
id: get_version
shell: bash
run: |
version="$(sed -n 's/.*<Version>\(.*\)<\/Version>.*/\1/p' Directory.Packages.props | head -1 | tr -d '[:space:]')"
if [ -z "$version" ]; then
echo "Version not found in Directory.Packages.props" >&2
exit 1
fi
case "$version" in
*'$('*)
echo "Unresolved version token in template: $version" >&2
exit 1
;;
esac
echo "version=$version" >> "$GITHUB_OUTPUT"
echo "Final version: $version"
- name: Build and push opendeepwiki
uses: docker/build-push-action@v5
with:
context: .
file: src/OpenDeepWiki/Dockerfile
platforms: linux/amd64
push: true
provenance: false
sbom: false
# GHA 层缓存:apt/pip、restore、编译层在多次构建间复用
# scope 与 release.yml 保持一致,可跨 workflow 共享缓存
cache-from: type=gha,scope=backend
cache-to: type=gha,mode=max,scope=backend
tags: |
crpi-j9ha7sxwhatgtvj4.cn-shenzhen.personal.cr.aliyuncs.com/open-deepwiki/opendeepwiki:latest
crpi-j9ha7sxwhatgtvj4.cn-shenzhen.personal.cr.aliyuncs.com/open-deepwiki/opendeepwiki:${{ steps.get_version.outputs.version }}
web:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Registry
uses: docker/login-action@v3
with:
registry: crpi-j9ha7sxwhatgtvj4.cn-shenzhen.personal.cr.aliyuncs.com
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Extract version from Directory.Packages.props
id: get_version
shell: bash
run: |
version="$(sed -n 's/.*<Version>\(.*\)<\/Version>.*/\1/p' Directory.Packages.props | head -1 | tr -d '[:space:]')"
if [ -z "$version" ]; then
echo "Version not found in Directory.Packages.props" >&2
exit 1
fi
case "$version" in
*'$('*)
echo "Unresolved version token in template: $version" >&2
exit 1
;;
esac
echo "version=$version" >> "$GITHUB_OUTPUT"
echo "Final version: $version"
- name: Build and push opendeepwiki-web
uses: docker/build-push-action@v5
with:
context: ./web
file: ./web/Dockerfile
platforms: linux/amd64
push: true
provenance: false
sbom: false
cache-from: type=gha,scope=web
cache-to: type=gha,mode=max,scope=web
tags: |
crpi-j9ha7sxwhatgtvj4.cn-shenzhen.personal.cr.aliyuncs.com/open-deepwiki/opendeepwiki-web:latest
crpi-j9ha7sxwhatgtvj4.cn-shenzhen.personal.cr.aliyuncs.com/open-deepwiki/opendeepwiki-web:${{ steps.get_version.outputs.version }}
docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Registry
uses: docker/login-action@v3
with:
registry: crpi-j9ha7sxwhatgtvj4.cn-shenzhen.personal.cr.aliyuncs.com
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Extract version from Directory.Packages.props
id: get_version
shell: bash
run: |
version="$(sed -n 's/.*<Version>\(.*\)<\/Version>.*/\1/p' Directory.Packages.props | head -1 | tr -d '[:space:]')"
if [ -z "$version" ]; then
echo "Version not found in Directory.Packages.props" >&2
exit 1
fi
case "$version" in
*'$('*)
echo "Unresolved version token in template: $version" >&2
exit 1
;;
esac
echo "version=$version" >> "$GITHUB_OUTPUT"
echo "Final version: $version"
- name: Build and push opendeepwiki-docs
uses: docker/build-push-action@v5
with:
context: ./docs
file: ./docs/Dockerfile
platforms: linux/amd64
push: true
provenance: false
sbom: false
cache-from: type=gha,scope=docs
cache-to: type=gha,mode=max,scope=docs
tags: |
crpi-j9ha7sxwhatgtvj4.cn-shenzhen.personal.cr.aliyuncs.com/open-deepwiki/opendeepwiki-docs:latest
crpi-j9ha7sxwhatgtvj4.cn-shenzhen.personal.cr.aliyuncs.com/open-deepwiki/opendeepwiki-docs:${{ steps.get_version.outputs.version }}