mirror of
https://github.com/mzzsfy/Dockerfile.git
synced 2026-06-04 21:01:18 +08:00
66 lines
2.1 KiB
YAML
66 lines
2.1 KiB
YAML
name: go-cqhttp
|
|
on:
|
|
workflow_dispatch:
|
|
schedule:
|
|
- cron: '0 16 * * 6'
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Check Out
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Setup timezone
|
|
uses: zcong1993/setup-timezone@master
|
|
with:
|
|
timezone: Asia/Shanghai
|
|
|
|
- name: ready
|
|
run: |
|
|
rm -rf {*,.[^.]*,..?*}
|
|
git clone --depth=1 https://github.com/Mrs4s/go-cqhttp.git .
|
|
git fetch --tags --depth=10
|
|
git checkout $(git tag -l | tac | grep -E '.*fix.*|v[0-9\.]+(-[rc0-9])?' | head -n 1)
|
|
wget https://raw.githubusercontent.com/mzzsfy/Dockerfile/main/go-cqhttp/docker-entrypoint.sh -O docker-entrypoint.sh
|
|
chmod +x docker-entrypoint.sh
|
|
echo 'COPY docker-entrypoint.sh /' >> Dockerfile
|
|
echo 'ENTRYPOINT [ "/docker-entrypoint.sh" ]' >> Dockerfile
|
|
|
|
# docker login
|
|
- name: Login to Docker Hub
|
|
uses: docker/login-action@v2
|
|
with:
|
|
username: ${{ secrets.DOCKER_HUB_USERNAME }}
|
|
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
|
|
|
|
# 设置 docker buildx 环境
|
|
- name: Set up Docker Buildx
|
|
id: buildx
|
|
uses: docker/setup-buildx-action@v2
|
|
|
|
# build 前置操作
|
|
- name: Docker before
|
|
id: docker_before
|
|
run: |
|
|
image="${{ secrets.DOCKER_HUB_USERNAME }}/go-cqhttp"
|
|
tags="$image:$(date +'%m-%d_%H-%M-%S'),$image:latest"
|
|
echo "target images $tags"
|
|
echo "tags=$tags" >> $GITHUB_OUTPUT
|
|
# 一个特殊镜像,修复某些buildx 的 bug
|
|
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes > /dev/null 2>&1
|
|
|
|
# build 并且 push docker 镜像
|
|
- name: Build and push
|
|
id: docker_build
|
|
uses: docker/build-push-action@v3
|
|
with:
|
|
context: .
|
|
file: ./Dockerfile
|
|
push: true
|
|
tags: ${{steps.docker_before.outputs.tags}}
|
|
platforms: linux/amd64,linux/arm64/v8
|
|
|
|
# 打印 docker 镜像 SHA256 Hash 值
|
|
- name: Image digest
|
|
run: echo ${{ steps.docker_build.outputs.digest }}
|