Compare commits
2 Commits
Author | SHA1 | Date |
---|---|---|
Stille | 05b9e83467 | |
Stille | 83b1dfafdc |
|
@ -1,42 +0,0 @@
|
|||
name: "serverstatus docker build"
|
||||
|
||||
env:
|
||||
PROJECT: serverstatus
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
- name: Set tag
|
||||
id: tag
|
||||
run: |
|
||||
TAG=$(cat Dockerfile | awk 'NR==4 {print $3}')
|
||||
echo "::set-env name=TAG::$TAG"
|
||||
- name: Docker Hub login
|
||||
env:
|
||||
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
|
||||
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
|
||||
run: |
|
||||
echo "${DOCKER_PASSWORD}" | docker login --username ${DOCKER_USERNAME} --password-stdin
|
||||
- name: Set up Docker Buildx
|
||||
id: buildx
|
||||
uses: crazy-max/ghaction-docker-buildx@v1
|
||||
with:
|
||||
buildx-version: latest
|
||||
- name: Build Dockerfile
|
||||
env:
|
||||
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
|
||||
run: |
|
||||
docker buildx build \
|
||||
--platform=linux/amd64,linux/arm64 \
|
||||
--output "type=image,push=true" \
|
||||
--file Dockerfile . \
|
||||
--tag $(echo "${DOCKER_USERNAME}" | tr '[:upper:]' '[:lower:]')/${{ env.PROJECT }}:latest \
|
||||
--tag $(echo "${DOCKER_USERNAME}" | tr '[:upper:]' '[:lower:]')/${{ env.PROJECT }}:${TAG}
|
|
@ -0,0 +1,71 @@
|
|||
name: "docker build release"
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
|
||||
env:
|
||||
PROJECT: serverstatus
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2.3.5
|
||||
|
||||
- name: Set tag
|
||||
id: tag
|
||||
run: |
|
||||
if [[ -n $(cat Dockerfile | awk '{if($1~"ENV" && $2=="VERSION")print $3}') ]]; then
|
||||
VERSION=$(cat Dockerfile | awk '{if($1~"ENV" && $2=="VERSION")print $3}')
|
||||
echo "tag=$VERSION" >> $GITHUB_ENV
|
||||
else
|
||||
echo "tag=$(date +%Y)-$(date +%m)-$(date +%d)" >> $GITHUB_ENV
|
||||
fi
|
||||
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v1
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v1
|
||||
|
||||
- name: Login Docker Hub
|
||||
uses: docker/login-action@v1
|
||||
with:
|
||||
username: ${{ secrets.DOCKER_USERNAME }}
|
||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||
|
||||
- name: Build and push to docker hub
|
||||
uses: docker/build-push-action@v2
|
||||
with:
|
||||
context: .
|
||||
platforms: linux/amd64,linux/arm64
|
||||
push: true
|
||||
tags: |
|
||||
${{ secrets.DOCKER_USERNAME }}/${{ env.PROJECT }}:latest
|
||||
${{ secrets.DOCKER_USERNAME }}/${{ env.PROJECT }}:${{ env.tag }}
|
||||
|
||||
- name: Sync README.md to Docker Hub
|
||||
uses: ms-jpq/sync-dockerhub-readme@v1
|
||||
with:
|
||||
username: ${{ secrets.DOCKER_USERNAME }}
|
||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||
repository: ${{ secrets.DOCKER_USERNAME }}/${{ env.PROJECT }}
|
||||
readme: "./README.md"
|
||||
|
||||
- name: Login harbor
|
||||
uses: docker/login-action@v1
|
||||
with:
|
||||
registry: ${{ secrets.HARBOR_REGISTRY }}
|
||||
username: ${{ secrets.HARBOR_USERNAME }}
|
||||
password: ${{ secrets.HARBOR_PASSWORD }}
|
||||
|
||||
- name: Build and push to harbor
|
||||
uses: docker/build-push-action@v2
|
||||
with:
|
||||
context: .
|
||||
platforms: linux/amd64,linux/arm64
|
||||
push: true
|
||||
tags: |
|
||||
${{ secrets.HARBOR_REGISTRY }}/${{ secrets.HARBOR_USERNAME }}/${{ env.PROJECT }}:latest
|
||||
${{ secrets.HARBOR_REGISTRY }}/${{ secrets.HARBOR_USERNAME }}/${{ env.PROJECT }}:${{ env.tag }}
|
|
@ -1,5 +1,5 @@
|
|||
FROM ubuntu:bionic-20200112 as builder
|
||||
MAINTAINER Stille <stille@ioiox.com>
|
||||
LABEL maintainer="Stille <stille@ioiox.com>"
|
||||
|
||||
ENV VERSION 2.0
|
||||
WORKDIR /
|
||||
|
@ -11,7 +11,7 @@ RUN apt-get update && \
|
|||
cp -rf /web /usr/local/ServerStatus/
|
||||
|
||||
FROM nginx:1.17.8
|
||||
MAINTAINER Stille <stille@ioiox.com>
|
||||
LABEL maintainer="Stille <stille@ioiox.com>"
|
||||
|
||||
COPY --from=builder /usr/local/ServerStatus/server /ServerStatus/server/
|
||||
COPY --from=builder /usr/local/ServerStatus/web /usr/share/nginx/html/
|
||||
|
|
26
README.md
26
README.md
|
@ -9,26 +9,37 @@ ServerStatus 在 GitHub 上已经有各种版本,本项目是基于 [ToyoDAdoubi
|
|||
**2021-06-06** 更新 docker 镜像同时支持 X86 和 ARM
|
||||
|
||||
## 部署
|
||||
### 创建配置文件
|
||||
### docker 部署
|
||||
推荐直接 **git clone** 本仓库到服务器 **/root** 目录内.或者手动下载仓库中的 **config.json** 至 **/root/ServerStatus/** 目录内.
|
||||
```shell
|
||||
cd /root
|
||||
git clone https://github.com/stilleshan/ServerStatus.git
|
||||
```
|
||||
|
||||
### 启动容器
|
||||
示例 **8888** 端口为 Web 访问端口, **35601** 为客户端通信端口,根据需求自行修改映射端口.注意防火墙需放行此端口.
|
||||
```shell
|
||||
docker run -d --name=serverstatus --restart=always -p 8888:80 -p 35601:35601 -v ~/ServerStatus/config.json:/ServerStatus/server/config.json stilleshan/serverstatus
|
||||
docker run -d --name=serverstatus --restart=always \
|
||||
-p 8888:80 \
|
||||
-p 35601:35601 \
|
||||
-v ~/ServerStatus/config.json:/ServerStatus/server/config.json \
|
||||
stilleshan/serverstatus
|
||||
```
|
||||
|
||||
### docker compose 部署
|
||||
```shell
|
||||
cd /root
|
||||
git clone https://github.com/stilleshan/ServerStatus.git
|
||||
cd ServerStatus
|
||||
docker-compose up -d
|
||||
```
|
||||
|
||||
## 使用
|
||||
### 访问地址
|
||||
```
|
||||
http://服务器IP:8888
|
||||
```
|
||||
> 使用域名和 HTTPS 协议可配置 Nginx 反向代理
|
||||
|
||||
|
||||
### 配置
|
||||
**config.json** 为服务器端配置文件,默认已经添加示例配置,可以根据示例格式修改,删除或者增加服务器.修改完毕后重启容器.
|
||||
```shell
|
||||
|
@ -38,7 +49,12 @@ docker restart serverstatus
|
|||
### 自定义前端页面
|
||||
上述默认启动命令没有挂载 web 目录,如需自定义修改前端页面,需 **git clone** 本仓库到服务器 **/root** 目录内,执行以下命令挂载 web 目录.
|
||||
```shell
|
||||
docker run -d --name=serverstatus --restart=always -p 8888:80 -p 35601:35601 -v ~/ServerStatus/config.json:/ServerStatus/server/config.json -v ~/ServerStatus/web:/usr/share/nginx/html stilleshan/serverstatus
|
||||
docker run -d --name=serverstatus --restart=always \
|
||||
-p 8888:80 \
|
||||
-p 35601:35601 \
|
||||
-v ~/ServerStatus/config.json:/ServerStatus/server/config.json \
|
||||
-v ~/ServerStatus/web:/usr/share/nginx/html \
|
||||
stilleshan/serverstatus
|
||||
```
|
||||
|
||||
### 客户端
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
version: "3"
|
||||
services:
|
||||
serverstatus:
|
||||
image: stilleshan/serverstatus
|
||||
container_name: serverstatus
|
||||
ports:
|
||||
- 8888:80
|
||||
- 35601:35601
|
||||
volumes:
|
||||
# - ./web:/usr/share/nginx/html
|
||||
- ./config.json:/ServerStatus/server/config.json
|
||||
environment:
|
||||
TZ: Asia/Shanghai
|
||||
restart: always
|
Binary file not shown.
After Width: | Height: | Size: 5.8 KiB |
Loading…
Reference in New Issue