File tree Expand file tree Collapse file tree 3 files changed +33
-3
lines changed Expand file tree Collapse file tree 3 files changed +33
-3
lines changed Original file line number Diff line number Diff line change
1
+ name : Docker Image CI
2
+
3
+ on :
4
+ push :
5
+ branches : [ "master" ]
6
+ pull_request :
7
+ branches : [ "master" ]
8
+
9
+ jobs :
10
+
11
+ build :
12
+
13
+ runs-on : ubuntu-latest
14
+
15
+ steps :
16
+ - uses : actions/checkout@v4
17
+ - name : Build the Docker image
18
+ run : |
19
+ docker login --username=springhgui0127 registry.cn-hangzhou.aliyuncs.com --password=${{ secrets.PASSWORD }}
20
+ version=$(grep "<Version>" src/Directory.Build.props | awk -F'[<>]' '{print $3}')
21
+ echo $version
22
+ tag=registry.cn-hangzhou.aliyuncs.com/hgui/opentask:$version-$(date +%s)
23
+ echo $tag
24
+ docker build . --file Dockerfile --tag $tag
25
+ docker push $tag
26
+
27
+
28
+
29
+
Original file line number Diff line number Diff line change @@ -25,7 +25,7 @@ ARG BUILD_CONFIGURATION=Release
25
25
RUN dotnet publish "OpenTask.WebApi.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false
26
26
27
27
# ui
28
- FROM docker.m.daocloud.io /node:20.12.0 AS ui
28
+ FROM registry.cn-hangzhou.aliyuncs.com/hgui /node:20.12.0 AS ui
29
29
WORKDIR /app
30
30
COPY ["ui/vite-opentask" , "./" ]
31
31
RUN rm -rf package-lock.json node_modules
Original file line number Diff line number Diff line change 7
7
8
8
# 读取文件内容,并使用grep和awk提取Version的值
9
9
version=$( grep " <Version>" src/Directory.Build.props | awk -F' [<>]' ' {print $3}' )
10
- appName=opentask
10
+ appName=registry.cn-hangzhou.aliyuncs.com/hgui/ opentask: $version
11
11
# 输出Version的值
12
12
echo " Version: $version "
13
13
14
- docker build . -t $appName : $version
14
+ docker build . -t $appName
15
15
if [ $? -ne 0 ]; then
16
16
echo " docker image build fail 😭😭😭"
17
17
else
18
18
echo " docker image build success 🎉🎉🎉"
19
19
fi
20
20
21
+ docker push $appName
21
22
read
22
23
exit 1
You can’t perform that action at this time.
0 commit comments