Spaces:
Runtime error
Runtime error
#------------------------ | |
# STAGE 1: Backend build | |
#------------------------ | |
FROM python:3.9-slim-buster as backend | |
WORKDIR /app/backend | |
# Copy necessary files | |
COPY requirements.txt . | |
COPY build_scripts/build.sh . | |
# Set environment variable, make the script executable and run it | |
ENV STAGE=backend | |
RUN chmod +x ./build.sh && \ | |
./build.sh backend && \ | |
rm -rf /var/lib/apt/lists/* | |
# Copy the rest of the backend app | |
COPY web_app/backend/ . | |
CMD ["python", "run.py"] | |
#------------------------- | |
# STAGE 2: Frontend build | |
#------------------------- | |
FROM node:14-alpine as frontend | |
WORKDIR /app/frontend | |
# Grouped copy for package-related files and the frontend app | |
COPY web_app/frontend/package*.json . | |
COPY web_app/frontend/ . | |
COPY build_scripts/build.sh . | |
# Set environment variables, make the script executable and run it | |
ENV STAGE=frontend | |
RUN chmod +x ./build.sh && ./build.sh frontend | |
EXPOSE 3000 | |
CMD ["serve", "-s", "dist", "-l", "3000"] | |