Skip to content

Commit

Permalink
Merge branch 'ceajs:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
luckycat0426 authored Oct 30, 2021
2 parents 99357a6 + d28358f commit e5d8886
Show file tree
Hide file tree
Showing 2 changed files with 88 additions and 4 deletions.
69 changes: 69 additions & 0 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: Docker

on:
push:
# Publish `main` as Docker `latest` image.
branches:
- main

# Publish `v1.2.3` tags as releases.
tags:
- v*

# Run tests for any PRs.
pull_request:

env:
# TODO: Change variable to your image's name.
IMAGE_NAME: cea-check-in

jobs:
# Run tests.
# See also https://docs.docker.com/docker-hub/builds/automated-testing/
test:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Run tests
run: |
if [ -f docker-compose.test.yml ]; then
docker-compose --file docker-compose.test.yml build
docker-compose --file docker-compose.test.yml run sut
else
docker build https://github.com/ceajs/cea.git#main:docker
fi
# Push image to GitHub Packages.
# See also https://docs.docker.com/docker-hub/builds/
push:
# Ensure test job passes before pushing image.
needs: test

runs-on: ubuntu-latest
if: github.event_name == 'push'

steps:
- uses: actions/checkout@v2

- name: Build image
run: docker build https://github.com/ceajs/cea.git#main:docker --tag $IMAGE_NAME

- name: Log into registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin

- name: Push image
run: |
IMAGE_ID=ghcr.io/${{ github.repository }}/$IMAGE_NAME
# Change all uppercase to lowercase
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')
# Strip git ref prefix from version
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
# Strip "v" prefix from tag name
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//')
# Use Docker `latest` tag convention
[ "$VERSION" == "master" ] && VERSION=latest
echo IMAGE_ID=$IMAGE_ID
echo VERSION=$VERSION
docker tag $IMAGE_NAME $IMAGE_ID:$VERSION
docker push $IMAGE_ID:$VERSION
23 changes: 19 additions & 4 deletions docs/deploy.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,33 @@
2. 构建 Image 并运行 Container

```bash
# 在本地构建 Image
sudo docker build -t cea-check-in https://github.com/ceajs/cea.git#main:docker
sudo docker run -dv /tmp/conf:/tmp/conf cea-check-in

# 创建容器
sudo docker run --name auto-check-in -dv /tmp/conf:/tmp/conf cea-check-in
```

如果使用境内服务器,由于网络问题,构建可能失败,可以使用本仓库已经构建完成的镜像

```bash
sudo docker run --name auto-check-in -dv /tmp/conf:/tmp/conf ghcr.io/ceajs/cea/cea-check-in:main
```

此容器自动设置了 Cron 任务,将会在每天 6:30 触发执行签到,如需自定义触发时间,请 Fork 本仓库,修改 `docker/cea-cron`,并另行构建镜像与容器
此容器自动设置了 Cron 任务,将会在每天 6:30 触发执行签到,如需自定义触发时间,请 Fork 本仓库(或者 Clone 本仓库),修改 `docker/cea-cron`,并另行构建镜像与容器

```
# 如果你是 Fork 并 Push 了修改
sudo docker build -t cea-check-in Fork仓库的GitURL#main:docker
sudo docker run -dv /tmp/conf:/tmp/conf cea-check-in
# 如果你是 Clone 并在本地修改,请进入 docker 文件夹
sudo docker build -t cea-check-in .
# 创建容器
sudo docker run --name auto-check-in -dv /tmp/conf:/tmp/conf cea-check-in
```

</details>
</details>

<details><summary>腾讯云开发一键部署</summary>

Expand Down

0 comments on commit e5d8886

Please sign in to comment.