blob: 670ad04596f5a4255b367b54eeb0f3b906a60ecf [file]
FROM node:20 as build-stage
# Set working directory
WORKDIR /usr/src/app
# Accept environment variables as build arguments
ARG REACT_APP_AUTH_MODE
ARG REACT_APP_USE_POSTHOG
ARG REACT_APP_API_URL
# Install app dependencies by copying package.json and package-lock.json
COPY frontend/package.json frontend/package-lock.json ./
# Install dependencies
RUN npm install
# Copy the rest of the frontend directory
COPY frontend .
# Environment variables
ENV REACT_APP_AUTH_MODE=${REACT_APP_AUTH_MODE}
ENV REACT_APP_USE_POSTHOG=${REACT_APP_USE_POSTHOG}
ENV REACT_APP_API_URL=${REACT_APP_API_URL}
ENV NODE_OPTIONS="--max-old-space-size=8192"
RUN npm run build
FROM nginx:stable-alpine as production-stage
# Copy the build output to replace the default nginx contents.
COPY --from=build-stage /usr/src/app/build /usr/share/nginx/html
# Expose port 80 to the outside once the container has launched
EXPOSE 8242
# Use the default nginx.conf provided by tiangolo/nginx-rtmp
COPY ./deployment/nginx/nginx.conf /etc/nginx/nginx.conf
CMD ["echo", "Frontend running on port 8242, go to http://localhost:8242 to view the app."]
# Start Nginx and keep the process from backgrounding and the container from quitting
CMD ["nginx", "-g", "daemon off;"]