Compare commits

...

4 Commits

Author SHA1 Message Date
liumangmang
4967356f22 docs: add docker deploy instructions 2026-03-26 17:10:50 +08:00
liumangmang
1a0c14c683 feat: add make targets for docker deploy 2026-03-26 16:56:48 +08:00
liumangmang
a1bf9e1d4b feat: add compose service for production deploy 2026-03-26 16:53:17 +08:00
liumangmang
7238aa9ca5 feat: add docker build for static site 2026-03-26 16:45:03 +08:00
5 changed files with 53 additions and 0 deletions

5
.dockerignore Normal file
View File

@@ -0,0 +1,5 @@
node_modules
dist
src/.vuepress/dist
.git
*.log

13
Dockerfile Normal file
View File

@@ -0,0 +1,13 @@
FROM node:20-alpine AS build
WORKDIR /app
COPY package.json package-lock.json ./
RUN npm ci
COPY . .
RUN npm run docs:build
FROM nginx:1.25-alpine
COPY --from=build /app/src/.vuepress/dist /usr/share/nginx/html

7
Makefile Normal file
View File

@@ -0,0 +1,7 @@
.PHONY: up down
up:
docker compose up -d --build
down:
docker compose down

View File

@@ -42,6 +42,24 @@ npm run docs:build
构建产物将生成在 `src/.vuepress/dist` 目录
### Docker 部署
需要先安装 Docker 和 Docker Compose v2。
启动服务:
```bash
make up
```
访问 `http://localhost:6666/` 即可查看站点。
停止服务:
```bash
make down
```
### 清除缓存开发
```bash

10
docker-compose.yml Normal file
View File

@@ -0,0 +1,10 @@
version: '3.8'
services:
myblog:
image: myblog:latest
build:
context: .
ports:
- '6666:80'
restart: unless-stopped