testtest123's picture
Final Build: Dockeerized Frontend/Backend with full RAG multi-format support
1b08040
Raw
History Blame Contribute Delete
682 Bytes
# Build stage
FROM node:20-alpine as build-stage
WORKDIR /app
# Add this line to accept the variable during build
ARG VITE_API_BASE_URL
ENV VITE_API_BASE_URL=$VITE_API_BASE_URL
COPY package*.json ./
RUN npm install
COPY . .
# Note: VITE_API_BASE_URL will be injected by docker-compose
RUN npm run build
# Production stage
FROM nginx:stable-alpine as production-stage
COPY --from=build-stage /app/dist /usr/share/nginx/html
# Add Nginx config for SPA routing (important!)
RUN echo "server { listen 80; location / { root /usr/share/nginx/html; index index.html; try_files \$uri \$uri/ /index.html; } }" > /etc/nginx/conf.d/default.conf
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]