Skip to content

Commit a9caeb8

Browse files
committed
Merge branch 'master' of https://github.com/SpringHgui/OpenTask
2 parents 2ba2325 + e2dd53f commit a9caeb8

File tree

3 files changed

+33
-3
lines changed

3 files changed

+33
-3
lines changed

.github/workflows/docker-image.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
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+

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ ARG BUILD_CONFIGURATION=Release
2525
RUN dotnet publish "OpenTask.WebApi.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false
2626

2727
# 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
2929
WORKDIR /app
3030
COPY ["ui/vite-opentask", "./"]
3131
RUN rm -rf package-lock.json node_modules

publish.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,17 @@ fi
77

88
# 读取文件内容,并使用grep和awk提取Version的值
99
version=$(grep "<Version>" src/Directory.Build.props | awk -F'[<>]' '{print $3}')
10-
appName=opentask
10+
appName=registry.cn-hangzhou.aliyuncs.com/hgui/opentask:$version
1111
# 输出Version的值
1212
echo "Version: $version"
1313

14-
docker build . -t $appName:$version
14+
docker build . -t $appName
1515
if [ $? -ne 0 ]; then
1616
echo "docker image build fail 😭😭😭"
1717
else
1818
echo "docker image build success 🎉🎉🎉"
1919
fi
2020

21+
docker push $appName
2122
read
2223
exit 1

0 commit comments

Comments
 (0)