From d87d4eb84b86e9681deae20156b2b4c7b6cee8bd Mon Sep 17 00:00:00 2001 From: fifsky Date: Wed, 18 Mar 2020 22:26:07 +0800 Subject: [PATCH] web to local --- .github/workflows/mail.yml | 23 +++++++++++++++++++---- web/Dockerfile | 3 +++ 2 files changed, 22 insertions(+), 4 deletions(-) create mode 100644 web/Dockerfile diff --git a/.github/workflows/mail.yml b/.github/workflows/mail.yml index 1c55523..65704fa 100644 --- a/.github/workflows/mail.yml +++ b/.github/workflows/mail.yml @@ -13,6 +13,11 @@ jobs: go-version: 1.13 id: go + - name: Set up Node + uses: actions/setup-node@v1 + with: + node-version: '10.x' + - name: Check out code into the Go module directory uses: actions/checkout@v1 @@ -20,11 +25,16 @@ jobs: run: | cd api go get -v -t -d ./... - - name: Build the Golang + - name: Build Golang api run: | cd api CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o app main.go + - name: Build web + run: | + cd web + npm install && npm run build + - name: Build the Docker image run: | cd api @@ -32,6 +42,9 @@ jobs: docker login --username=${{secrets.DOCKER_USERNAME}} --password=${{secrets.DOCKER_PASSWORD}} registry.cn-shanghai.aliyuncs.com docker build . --file Dockerfile --tag registry.cn-shanghai.aliyuncs.com/fifsky/gostruct docker push registry.cn-shanghai.aliyuncs.com/fifsky/gostruct + cd ../web + docker build . --file Dockerfile --tag registry.cn-shanghai.aliyuncs.com/fifsky/gostruct-web + docker push registry.cn-shanghai.aliyuncs.com/fifsky/gostruct-web - name: Publish to Aliyun uses: fifsky/ssh-action@master @@ -41,11 +54,13 @@ jobs: key: ${{ secrets.PRIVATE_KEY}} command: | docker login --username=${{secrets.DOCKER_USERNAME}} --password=${{secrets.DOCKER_PASSWORD}} registry-vpc.cn-shanghai.aliyuncs.com - docker stop gostruct - docker rm gostruct - docker rmi registry-vpc.cn-shanghai.aliyuncs.com/fifsky/gostruct:latest + docker stop gostruct gostruct-web + docker rm gostruct gostruct-web + docker rmi registry-vpc.cn-shanghai.aliyuncs.com/fifsky/gostruct:latest registry-vpc.cn-shanghai.aliyuncs.com/fifsky/gostruct-web:latest docker pull registry-vpc.cn-shanghai.aliyuncs.com/fifsky/gostruct + docker pull registry-vpc.cn-shanghai.aliyuncs.com/fifsky/gostruct-web docker run -d --name gostruct --restart always --network fifsky --network-alias gostruct registry-vpc.cn-shanghai.aliyuncs.com/fifsky/gostruct + docker run -d --name gostruct-web --restart always --network fifsky --network-alias gostruct-web registry-vpc.cn-shanghai.aliyuncs.com/fifsky/gostruct-web - name: Dingtalk message uses: fifsky/dingtalk-action@master diff --git a/web/Dockerfile b/web/Dockerfile new file mode 100644 index 0000000..f51c736 --- /dev/null +++ b/web/Dockerfile @@ -0,0 +1,3 @@ +FROM abiosoft/caddy:latest +COPY ./Caddyfile /etc/Caddyfile +COPY ./dist/ /usr/share/caddy/ \ No newline at end of file