This commit is contained in:
zhangjianjun 2026-07-09 16:21:45 +08:00
parent 8d1bf90ba3
commit 2b534eda80
4 changed files with 68 additions and 0 deletions

10
.dockerignore Normal file
View File

@ -0,0 +1,10 @@
node_modules
dist
dist-ssr
.git
.idea
.vscode
*.log
Dockerfile
docker-compose.yml
README.md

26
Dockerfile Normal file
View File

@ -0,0 +1,26 @@
FROM node:24-alpine AS build
WORKDIR /app
RUN corepack enable
COPY package.json pnpm-lock.yaml ./
RUN pnpm install --frozen-lockfile
COPY . .
ARG VITE_BASE_URL=http://twin.batiao8.com
ARG VITE_APP_ID=10063
ENV VITE_BASE_URL=$VITE_BASE_URL
ENV VITE_APP_ID=$VITE_APP_ID
RUN pnpm build
FROM nginx:1.27-alpine AS runtime
COPY nginx.conf /etc/nginx/conf.d/default.conf
COPY --from=build /app/dist /usr/share/nginx/html
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]

12
docker-compose.yml Normal file
View File

@ -0,0 +1,12 @@
services:
app-twins:
build:
context: .
args:
VITE_BASE_URL: http://twin.batiao8.com
VITE_APP_ID: "10063"
image: app-twins:latest
container_name: app-twins
restart: unless-stopped
ports:
- "8080:80"

20
nginx.conf Normal file
View File

@ -0,0 +1,20 @@
server {
listen 80;
server_name _;
root /usr/share/nginx/html;
index index.html;
location /api/ {
proxy_pass http://twin.batiao8.com/api/;
proxy_http_version 1.1;
proxy_set_header Host twin.batiao8.com;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
location / {
try_files $uri $uri/ /index.html;
}
}