mirror of https://github.com/certd/certd
chore: github action build
parent
a827bc306a
commit
a96d5839b2
|
@ -0,0 +1,62 @@
|
|||
name: build-image
|
||||
on:
|
||||
push:
|
||||
branches: ['v2']
|
||||
paths:
|
||||
- "build.trigger"
|
||||
|
||||
# schedule:
|
||||
# - # 国际时间 19:17 执行,北京时间3:17 ↙↙↙ 改成你想要每天自动执行的时间
|
||||
# - cron: '17 19 * * *'
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
sync:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout Code
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: get_certd_version
|
||||
id: get_certd_version
|
||||
uses: actions/github-script@v5
|
||||
with:
|
||||
script: |
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const jsonFilePath = path.join(__dirname, './packages/ui/certd-server/package.json');
|
||||
const jsonContent = fs.readFileSync(jsonFilePath, 'utf-8');
|
||||
const pkg = JSON.parse(jsonContent)
|
||||
// 打印 JSON 文件内容
|
||||
console.log("certd_version:",pkg.version);
|
||||
// 输出 JSON 对象,可以在后续步骤中使用
|
||||
return JSON.parse("0.0.5");
|
||||
|
||||
- name: Set up the working directory
|
||||
run: |
|
||||
mkdir -p /app/
|
||||
cp -r ./packages/ui/ /app/
|
||||
working-directory: /app/
|
||||
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v3
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Login to GitHub Container Registry
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: registry.cn-shenzhen.aliyuncs.com
|
||||
username: ${{ secrets.aliyun_cs_username }}
|
||||
password: ${{ secrets.aliyun_cs_password }}
|
||||
|
||||
- name: Build and push
|
||||
uses: docker/build-push-action@v6
|
||||
with:
|
||||
platforms: linux/amd64,linux/arm64
|
||||
push: true
|
||||
tags: |
|
||||
# registry.cn-shenzhen.aliyuncs.com/handsfree/certd:latest
|
||||
registry.cn-shenzhen.aliyuncs.com/handsfree/certd:${{steps.get_certd_version.outputs.version}}
|
35
README.md
35
README.md
|
@ -14,6 +14,7 @@ CertD 是一个免费全自动申请和自动部署更新SSL证书的工具。
|
|||
* 支持多个域名打到一个证书上
|
||||
* 邮件通知
|
||||
* 证书自动更新
|
||||
* 私有化部署,安全
|
||||
* 免费、免费、免费([阿里云单个通配符域名证书最便宜也要1800/年](https://yundun.console.aliyun.com/?p=cas#/certExtend/buy/cn-hangzhou))
|
||||
|
||||
|
||||
|
@ -54,52 +55,44 @@ https://docs.docker.com/engine/install/
|
|||
选择对应的操作系统,按照官方文档执行命令即可
|
||||
|
||||
|
||||
### 2. 下载docker-compose.yaml文件
|
||||
### 2. 运行certd
|
||||
|
||||
[docker-compose.yaml下载](https://gitee.com/certd/certd/raw/v2/docker/run/docker-compose.yaml)
|
||||
|
||||
```bash
|
||||
# 随便创建一个目录
|
||||
mkdir certd
|
||||
# 进入目录
|
||||
cd certd
|
||||
# wget下载docker-compose.yaml文件
|
||||
wget https://raw.githubusercontent.com/certd/certd/v2/docker/run/docker-compose.yaml
|
||||
# 或者使用gitee地址
|
||||
# 下载docker-compose.yaml文件,或者手动下载放到certd目录下
|
||||
wget https://gitee.com/certd/certd/raw/v2/docker/run/docker-compose.yaml
|
||||
|
||||
# 可以根据需要修改里面的配置
|
||||
# 1.修改镜像版本号【可选】
|
||||
# 2.配置数据保存路径【可选】
|
||||
# 3.修改端口号【可选】
|
||||
vi docker-compose.yaml
|
||||
|
||||
|
||||
```
|
||||
|
||||
### 3. 运行
|
||||
当前版本号: 
|
||||
|
||||
```bash
|
||||
# 设置镜像版本号环境变量,如果docker-compose.yaml中已经修改,请忽略这条命令
|
||||
export CERTD_VERSION=latest # <---建议设置成固定版本号
|
||||
vi docker-compose.yaml # 【可选】
|
||||
|
||||
# 启动certd
|
||||
docker compose up -d
|
||||
|
||||
```
|
||||
当前版本号: 
|
||||
|
||||
如果提示 没有compose命令,请安装docker-compose
|
||||
https://docs.docker.com/compose/install/linux/
|
||||
|
||||
|
||||
|
||||
### 4. 访问
|
||||
### 3. 访问
|
||||
|
||||
http://your_server_ip:7001
|
||||
默认账号密码:admin/123456
|
||||
记得修改密码
|
||||
|
||||
|
||||
### 5. 升级
|
||||
### 4. 升级
|
||||
|
||||
* 修改版本号,重新运行 `docker compose up -d` 即可
|
||||
* 修改`docker-compose.yaml`中的镜像版本号
|
||||
* 重新运行 `docker compose up -d` 即可
|
||||
* 数据存在`/data/certd`目录下,不用担心数据丢失
|
||||
|
||||
|
||||
|
@ -143,7 +136,7 @@ docker logs -f --tail 500 certd
|
|||
```shell
|
||||
docker compose up -d
|
||||
```
|
||||
5. 使用admin/123456登录系统,请及时修改管理员密码
|
||||
5. 使用`admin/123456`登录系统,请及时修改管理员密码
|
||||
|
||||
## 八、联系作者
|
||||
如有疑问,欢迎加入群聊(请备注certd)
|
||||
|
|
|
@ -1,25 +0,0 @@
|
|||
FROM registry.cn-shenzhen.aliyuncs.com/handsfree/node:18-alpine
|
||||
EXPOSE 7001
|
||||
WORKDIR /app/
|
||||
ENV node_sqlite3_binary_host_mirror https://registry.npmmirror.com/-/binary/sqlite3
|
||||
RUN npm install -g pnpm@8.15.7 --registry=https://registry.npmmirror.com
|
||||
RUN pnpm config set registry https://registry.npmmirror.com/
|
||||
|
||||
#RUN npm install cross-env -g --registry=https://registry.npmmirror.com
|
||||
#RUN npm install pm2 -g --registry=https://registry.npmmirror.com
|
||||
#RUN pm2 install pm2-logrotate
|
||||
ADD ./workspace/certd-server/ /app/
|
||||
RUN sed -i "s/workspace://g" "/app/package.json"
|
||||
#RUN yarn install --registry=https://registry.npmmirror.com
|
||||
#RUN yarn install --production
|
||||
RUN pnpm install
|
||||
RUN node ./before-build.js
|
||||
RUN npm run build
|
||||
ENV NODE_ENV production
|
||||
ENV MIDWAY_SERVER_ENV production
|
||||
#CMD ["pm2-runtime", "start", "./bootstrap.js","--name", "certd","-i","1"]
|
||||
CMD ["npm", "run","start"]
|
||||
|
||||
|
||||
|
||||
|
|
@ -1,38 +0,0 @@
|
|||
#!/bin/bash
|
||||
set -e
|
||||
echo "请先输入一个版本号:"
|
||||
read version
|
||||
|
||||
echo "您输入的版本号是: $version"
|
||||
echo "登录aliyun镜像仓库"
|
||||
sudo docker login --username=252959493@qq.com registry.cn-shenzhen.aliyuncs.com
|
||||
|
||||
build=$(pwd)
|
||||
cd ../../
|
||||
root=$(pwd)
|
||||
echo "安装依赖"
|
||||
#pnpm install --registry=https://registry.npmmirror.com
|
||||
pnpm install
|
||||
|
||||
|
||||
echo "packages build"
|
||||
|
||||
lerna run build
|
||||
echo "packages build success"
|
||||
|
||||
echo "server build"
|
||||
cd $root/packages/ui/certd-server
|
||||
pnpm run build
|
||||
echo "server build success"
|
||||
|
||||
echo "rm node_modules"
|
||||
rm ./node_modules -rf
|
||||
|
||||
echo "copy to workspace"
|
||||
mkdir -p $build/workspace/certd-server
|
||||
\cp ./* $build/workspace/certd-server -rf
|
||||
\cp ../certd-client/dist/* $build/workspace/certd-server/public/ -rf
|
||||
|
||||
#export TAG=$version
|
||||
#sudo -E docker compose build
|
||||
#sudo -E docker compose push
|
|
@ -1,15 +0,0 @@
|
|||
version: '3.3' # 指定docker-compose 版本
|
||||
services: # 要拉起的服务们
|
||||
certd:
|
||||
build:
|
||||
context: ./
|
||||
dockerfile: Dockerfile
|
||||
image: registry.cn-shenzhen.aliyuncs.com/handsfree/certd:${TAG}
|
||||
container_name: certd # 容器名
|
||||
restart: unless-stopped # 重启
|
||||
ports: # 端口映射
|
||||
- "7001:7001"
|
||||
environment:
|
||||
- TZ=Asia/Shanghai
|
||||
- node_sqlite3_binary_host_mirror=https://registry.npmmirror.com/-/binary/sqlite3
|
||||
|
|
@ -1,8 +1,8 @@
|
|||
version: '3.3'
|
||||
services:
|
||||
certd:
|
||||
# 镜像 # ↓↓↓↓↓ --- 1、 修改镜像版本号,或者干脆写成latest(不推荐), 如果设置了环境变量 export CERTD_VERSION=xxx,这里可以不修改
|
||||
image: registry.cn-shenzhen.aliyuncs.com/handsfree/certd:${CERTD_VERSION}
|
||||
# 镜像 # ↓↓↓↓↓ --- 1、 镜像版本号,建议改成固定版本号【可选】
|
||||
image: registry.cn-shenzhen.aliyuncs.com/handsfree/certd:latest
|
||||
container_name: certd # 容器名
|
||||
restart: unless-stopped # 自动重启
|
||||
volumes:
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
"publish": "npm run prepublishOnly1 && lerna publish --conventional-commits && npm run afterpublishOnly && npm run deploy1",
|
||||
"afterpublishOnly": "",
|
||||
"prepublishOnly1": "npm run check && npm run before-build && lerna run build ",
|
||||
"before-build": "cd ./packages/core/acme-client && time /t >build.md && git add ./build.md && git commit -m \"build: prepare to build\"",
|
||||
"before-build": "cd ./packages/core/acme-client && time /t >build.md && git add build.trigger && git commit -m \\\"build: prepare to build\\\"",
|
||||
"deploy1": "node --experimental-json-modules deploy.js ",
|
||||
"check": "node --experimental-json-modules publish-check.js",
|
||||
"init": "lerna run build"
|
||||
|
|
Loading…
Reference in New Issue