mirror of
https://github.com/Gar-b-age/CookLikeHOC.git
synced 2026-03-22 12:57:16 +08:00
25
Docker.md
Normal file
25
Docker.md
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
# Docker 打包运行说明
|
||||||
|
|
||||||
|
## 环境依赖
|
||||||
|
- Docker
|
||||||
|
|
||||||
|
## 打包
|
||||||
|
```bash
|
||||||
|
docker build -t cooklikehoc:0.0.1 -f Dockerfile .
|
||||||
|
```
|
||||||
|
|
||||||
|
## 运行
|
||||||
|
```bash
|
||||||
|
docker run -d --name cooklikehoc \
|
||||||
|
-p 3001:80 \
|
||||||
|
-e HOST=0.0.0.0 \
|
||||||
|
cooklikehoc:0.0.1
|
||||||
|
|
||||||
|
# 浏览器访问 http://localhost:3001/
|
||||||
|
```
|
||||||
|
|
||||||
|
## 效果
|
||||||
|
|
||||||
|

|
||||||
|

|
||||||
|

|
||||||
20
Dockerfile
Normal file
20
Dockerfile
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
# ============================
|
||||||
|
# Prepare dist Environment
|
||||||
|
FROM node:22-alpine AS dist-env
|
||||||
|
WORKDIR /app
|
||||||
|
# 在安装 git 前设置镜像源
|
||||||
|
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories && \
|
||||||
|
apk add --no-cache git
|
||||||
|
COPY . .
|
||||||
|
RUN npm install --loglevel verbose
|
||||||
|
RUN npm run build
|
||||||
|
|
||||||
|
# ============================
|
||||||
|
# Prepare Runtime Environment
|
||||||
|
FROM nginx:1-alpine
|
||||||
|
|
||||||
|
COPY default.conf /etc/nginx/conf.d/
|
||||||
|
|
||||||
|
COPY --from=dist-env /app/.vitepress/dist/ /usr/share/nginx/html
|
||||||
|
|
||||||
|
EXPOSE 80
|
||||||
12
default.conf
Normal file
12
default.conf
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
server {
|
||||||
|
listen 80;
|
||||||
|
server_name localhost;
|
||||||
|
root /usr/share/nginx/html;
|
||||||
|
|
||||||
|
location / {
|
||||||
|
index index.html index.htm;
|
||||||
|
try_files $uri $uri/ /index.html;
|
||||||
|
|
||||||
|
add_header Cache-Control "private, no-store, no-cache, must-revalidate, proxy-revalidate";
|
||||||
|
}
|
||||||
|
}
|
||||||
BIN
image-1.png
Normal file
BIN
image-1.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 209 KiB |
BIN
image-2.png
Normal file
BIN
image-2.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 205 KiB |
5
images/README.md
Normal file
5
images/README.md
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
# images
|
||||||
|
|
||||||
|
<!-- AUTO-GENERATED: index for images. Edit source files instead. -->
|
||||||
|
|
||||||
|
(暂无条目)
|
||||||
Reference in New Issue
Block a user