37 lines
No EOL
956 B
Docker
37 lines
No EOL
956 B
Docker
# Use the official Node.js image as a base
|
|
FROM node:20
|
|
|
|
# Set the working directory inside the container
|
|
WORKDIR /app
|
|
|
|
# Install pnpm globally with setup
|
|
ENV PNPM_HOME=/usr/local/bin
|
|
RUN npm install -g pnpm
|
|
|
|
# Copy package.json and package-lock.json to the working directory
|
|
COPY app/package*.json ./
|
|
|
|
# Install dependencies using pnpm
|
|
RUN pnpm install
|
|
|
|
# Set environment variables for the build
|
|
ARG REACT_APP_API_BASE_URL
|
|
ENV REACT_APP_API_BASE_URL=${REACT_APP_API_BASE_URL:-http://rag-service:8000}
|
|
|
|
# Copy specific folders to avoid node_modules
|
|
COPY app/public ./public
|
|
COPY app/src ./src
|
|
COPY app/*.json ./
|
|
|
|
# Build the React application with pnpm - show env vars for debugging
|
|
RUN echo "Building with API URL: $REACT_APP_API_BASE_URL" && \
|
|
pnpm run build
|
|
|
|
# Use npm for global installs (more reliable in Docker)
|
|
RUN npm install -g serve
|
|
|
|
# Expose the port the app runs on
|
|
EXPOSE 3000
|
|
|
|
# Command to run the application
|
|
CMD ["serve", "-s", "build"] |