Skip to content

Commit

Permalink
增加docker
Browse files Browse the repository at this point in the history
  • Loading branch information
happy888888 committed Dec 19, 2020
1 parent 7e1434e commit 6520e04
Show file tree
Hide file tree
Showing 4 changed files with 78 additions and 8 deletions.
14 changes: 7 additions & 7 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
bash ./publish_release/publish_ipk.sh
env:
version: ${{ github.event.inputs.version }}

- name: Create release info
id: create_release
uses: actions/create-release@v1
Expand All @@ -47,7 +47,7 @@ jobs:
asset_path: ./release/WeiboTask-windows_86-v${{ github.event.inputs.version }}.zip
asset_name: WeiboTask-windows_86-v${{ github.event.inputs.version }}.zip
asset_content_type: application/zip

- name: Upload linux_64
uses: actions/upload-release-asset@v1
env:
Expand All @@ -57,7 +57,7 @@ jobs:
asset_path: ./release/WeiboTask-linux_64-v${{ github.event.inputs.version }}.tar
asset_name: WeiboTask-linux_64-v${{ github.event.inputs.version }}.tar
asset_content_type: application/x-tar

- name: Upload linux_arm
uses: actions/upload-release-asset@v1
env:
Expand All @@ -67,7 +67,7 @@ jobs:
asset_path: ./release/WeiboTask-linux_arm-v${{ github.event.inputs.version }}.tar
asset_name: WeiboTask-linux_arm-v${{ github.event.inputs.version }}.tar
asset_content_type: application/x-tar

- name: Upload linux_arm64
uses: actions/upload-release-asset@v1
env:
Expand All @@ -77,7 +77,7 @@ jobs:
asset_path: ./release/WeiboTask-linux_arm64-v${{ github.event.inputs.version }}.tar
asset_name: WeiboTask-linux_arm64-v${{ github.event.inputs.version }}.tar
asset_content_type: application/x-tar

- name: Upload linux_mips
uses: actions/upload-release-asset@v1
env:
Expand All @@ -87,7 +87,7 @@ jobs:
asset_path: ./release/WeiboTask-linux_mips-v${{ github.event.inputs.version }}.tar
asset_name: WeiboTask-linux_mips-v${{ github.event.inputs.version }}.tar
asset_content_type: application/x-tar

- name: Upload linux_mipsle
uses: actions/upload-release-asset@v1
env:
Expand All @@ -107,7 +107,7 @@ jobs:
asset_path: ./ipk/WeiboTask_${{ github.event.inputs.version }}_mips.ipk
asset_name: WeiboTask_${{ github.event.inputs.version }}_mips.ipk
asset_content_type: application/x-gzip

- name: Upload linux_mipsle ipk
uses: actions/upload-release-asset@v1
env:
Expand Down
53 changes: 53 additions & 0 deletions .github/workflows/publish_docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: 'publish docker'

on:
workflow_dispatch:
inputs:
version:
description: '版本号'
required: true

jobs:
run:
runs-on: ubuntu-latest
if: github.event.repository.owner.id == github.event.sender.id
steps:

- name: Set up QEMU
uses: docker/setup-qemu-action@v1

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Build Dockerfile
uses: docker/build-push-action@v2
with:
platforms: linux/amd64
push: true
tags: |
happy888888/weibotask:${{ github.event.inputs.version }}
happy888888/weibotask:latest
- name: Build Dockerfile-arm
uses: docker/build-push-action@v2
with:
platforms: linux/arm/v7
push: true
tags: |
happy888888/weibotask:arm-${{ github.event.inputs.version }}
happy888888/weibotask:arm-latest
- name: Build Dockerfile-arm64
uses: docker/build-push-action@v2
with:
platforms: linux/arm64
push: true
tags: |
happy888888/weibotask:arm64-${{ github.event.inputs.version }}
happy888888/weibotask:arm64-latest
17 changes: 17 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
FROM golang:1.15.6-alpine3.12 as builder
WORKDIR /go
COPY ./src ./src
RUN CGO_ENABLED=0 GOPATH=$(pwd) go install -ldflags "-s -w" WeiboTask

FROM alpine:3.12
LABEL maintainer="星辰"

RUN apk update \
&& apk add tzdata \
&& cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \
&& echo "Asia/Shanghai" > /etc/timezone

COPY --from=builder /go/bin/WeiboTask /usr/bin/WeiboTask

ENTRYPOINT ["/usr/bin/WeiboTask", "-L"]
CMD ["-l", "/tmp/WeiboTask.log"]
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ WeiboTask

### 💥主要功能
* [x] 微博超话签到
* [ ] 每日积分获取
* [x] 每日积分获取

</br>

Expand Down

0 comments on commit 6520e04

Please sign in to comment.