fix: 修复Docker中打包的前端请求地址为本地
This commit is contained in:
+13
-5
@@ -1,4 +1,4 @@
|
||||
FROM node:22.21.1 as builder
|
||||
FROM node:22.21.1 AS builder
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
@@ -11,6 +11,11 @@ RUN npm install
|
||||
ENV NODE_ENV=production
|
||||
ENV PATH=/app/node_modules/.bin:$PATH
|
||||
|
||||
# 替换前端中的地址
|
||||
RUN sed -i 's#\${baseUrl}##g' /app/src/views/AccountManagement.vue
|
||||
RUN sed -i "s#\${import\.meta\.env\.VITE_API_BASE_URL || 'http:\/\/localhost:5409'}##g" /app/src/api/material.js
|
||||
RUN sed -i 's#localhost:5409##g' /app/.env.production
|
||||
|
||||
RUN npm run build
|
||||
|
||||
|
||||
@@ -20,10 +25,6 @@ WORKDIR /app
|
||||
|
||||
ENV PLAYWRIGHT_BROWSERS_PATH=/opt/playwright
|
||||
|
||||
COPY --from=builder /app/dist/index.html /app
|
||||
COPY --from=builder /app/dist/assets /app/assets
|
||||
COPY --from=builder /app/dist/vite.svg /app
|
||||
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends libnss3 \
|
||||
libnspr4 \
|
||||
libdbus-1-3 \
|
||||
@@ -48,8 +49,15 @@ RUN playwright install chromium-headless-shell
|
||||
|
||||
COPY . .
|
||||
|
||||
COPY --from=builder /app/dist/index.html /app
|
||||
COPY --from=builder /app/dist/assets /app/assets
|
||||
COPY --from=builder /app/dist/vite.svg /app/assets
|
||||
|
||||
RUN cp conf.example.py conf.py
|
||||
|
||||
RUN mkdir -p /app/videoFile
|
||||
RUN mkdir -p /app/cookiesFile
|
||||
|
||||
EXPOSE 5409
|
||||
|
||||
CMD ["python", "sau_backend.py"]
|
||||
|
||||
Reference in New Issue
Block a user