FROM node:16-alpine as build-frontend # Set the working directory WORKDIR /app # Copy package files and install dependencies COPY frontend/package*.json /app/frontend/ RUN npm install --prefix frontend/ RUN npm ci --prefix frontend/ # Copy the rest of the application files COPY frontend/ /app/frontend/ RUN --mount=type=secret,id=PUBLIC_BACKEND_WS_URL,mode=0444,required=true \ echo "PUBLIC_BACKEND_WS_URL=$(cat /run/secrets/PUBLIC_BACKEND_WS_URL)" > frontend/.env RUN npm run build --prefix frontend/ # Start a new stage using python:3.9-alpine FROM python:3.9-alpine # Copy the built front-end files COPY --from=build-frontend /app/frontend/build /app/build COPY /backend /app # Install uvicorn RUN pip install uvicorn fastapi # Set the working directory WORKDIR /app # Run the uvicorn server CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "8000"] EXPOSE 8000