Update docker compose for frontend

This commit is contained in:
Xin Wang
2026-02-08 22:37:30 +08:00
parent 68e47320cd
commit cd5d0a668d
4 changed files with 50 additions and 10 deletions

7
web/.dockerignore Normal file
View File

@@ -0,0 +1,7 @@
node_modules
dist
.git
.gitignore
*.md
.env
.env.*

24
web/Dockerfile Normal file
View File

@@ -0,0 +1,24 @@
# Build stage
FROM node:20-alpine AS builder
WORKDIR /app
COPY package.json package-lock.json ./
RUN npm ci
COPY . .
ARG VITE_API_BASE_URL=http://localhost:8100/api
ENV VITE_API_BASE_URL=$VITE_API_BASE_URL
RUN npm run build
# Serve stage (no nginx Node + serve on port 6000)
FROM node:20-alpine
RUN npm install -g serve
WORKDIR /app
COPY --from=builder /app/dist ./dist
EXPOSE 6000
CMD ["serve", "-s", "dist", "-l", "6000"]

View File

@@ -1,4 +1,4 @@
const DEFAULT_API_BASE_URL = 'http://localhost:8000/api';
const DEFAULT_API_BASE_URL = 'http://localhost:8100/api';
const trimTrailingSlash = (value: string): string => value.replace(/\/+$/, '');