ci: docker镜像构建

This commit is contained in:
RockChinQ
2024-06-27 10:31:27 +08:00
parent eb7ece72ad
commit 7bac7df87e
4 changed files with 100 additions and 0 deletions
+46
View File
@@ -0,0 +1,46 @@
name: 构建文档Docker镜像
on:
push:
branches:
- main
permissions:
contents: write
jobs:
build-docker-image:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: 设置 Node.js
uses: actions/setup-node@v3
with:
node-version: 18
- name: 安装 pnpm
run: |
npm install -g pnpm
- name: 安装依赖
run:
pnpm install
- name: 构建文档
env:
NODE_OPTIONS: --max_old_space_size=8192
run: |
pnpm run docs:build
ls -R
- name: Build image
run: |
docker build -t ${{ secrets.DOCKER_HUB_USERNAME }}/qchatgpt-wiki:latest .
- name: Publish image
run: |
docker login -u ${{ secrets.DOCKER_HUB_USERNAME }} -p ${{ secrets.DOCKER_HUB_PASSWORD }}
docker push ${{ secrets.DOCKER_HUB_USERNAME }}/qchatgpt-wiki:latest
+7
View File
@@ -0,0 +1,7 @@
FROM nginx:alpine
COPY ./src/.vuepress/dist/ /usr/share/nginx/html/
COPY ./nginx/nginx.conf /etc/nginx/nginx.conf
COPY ./nginx/default.conf /etc/nginx/conf.d/default.conf
EXPOSE 80
+18
View File
@@ -0,0 +1,18 @@
server {
listen 80;
server_name localhost;
location / {
root /usr/share/nginx/html;
index index.html index.htm;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}
+29
View File
@@ -0,0 +1,29 @@
user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
#tcp_nopush on;
keepalive_timeout 65;
#gzip on;
include /etc/nginx/conf.d/*.conf;
}