feat: 🎸 dockerfile

This commit is contained in:
GoCo 2025-07-22 16:51:54 +08:00
parent f518ea0966
commit e2443f4def
3 changed files with 32 additions and 0 deletions

10
Dockerfile Normal file
View File

@ -0,0 +1,10 @@
# 使用 node 构建阶段
FROM node:18 AS builder
WORKDIR /app
COPY . .
RUN npm install && npm run build
# 使用 nginx 作为生产环境
FROM nginx:stable-alpine
COPY --from=builder /app/dist /usr/share/nginx/html
COPY nginx.conf /etc/nginx/conf.d/default.conf

11
docker-compose.yaml Normal file
View File

@ -0,0 +1,11 @@
version: '3.8'
services:
vue-app:
build:
context: .
dockerfile: Dockerfile
ports:
- "55511:80"
container_name: vue3-nginx
restart: unless-stopped

11
nginx.conf Normal file
View File

@ -0,0 +1,11 @@
server {
listen 80;
server_name localhost;
root /usr/share/nginx/html;
index index.html;
location / {
try_files $uri $uri/ /index.html;
}
}