Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/SpringHgui/OpenTask
Browse files Browse the repository at this point in the history
  • Loading branch information
SpringHgui committed Jul 6, 2024
2 parents 2ba2325 + e2dd53f commit a9caeb8
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 3 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Docker Image CI

on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]

jobs:

build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Build the Docker image
run: |
docker login --username=springhgui0127 registry.cn-hangzhou.aliyuncs.com --password=${{ secrets.PASSWORD }}
version=$(grep "<Version>" src/Directory.Build.props | awk -F'[<>]' '{print $3}')
echo $version
tag=registry.cn-hangzhou.aliyuncs.com/hgui/opentask:$version-$(date +%s)
echo $tag
docker build . --file Dockerfile --tag $tag
docker push $tag
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ ARG BUILD_CONFIGURATION=Release
RUN dotnet publish "OpenTask.WebApi.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false

# ui
FROM docker.m.daocloud.io/node:20.12.0 AS ui
FROM registry.cn-hangzhou.aliyuncs.com/hgui/node:20.12.0 AS ui
WORKDIR /app
COPY ["ui/vite-opentask", "./"]
RUN rm -rf package-lock.json node_modules
Expand Down
5 changes: 3 additions & 2 deletions publish.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,17 @@ fi

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

docker build . -t $appName:$version
docker build . -t $appName
if [ $? -ne 0 ]; then
echo "docker image build fail 😭😭😭"
else
echo "docker image build success 🎉🎉🎉"
fi

docker push $appName
read
exit 1

0 comments on commit a9caeb8

Please sign in to comment.