Spaces:
Sleeping
Sleeping
# First stage: Build and load the dataset | |
FROM python:3.9 as core | |
# Set the working directory | |
WORKDIR /app/core | |
# Copy and install core requirements | |
COPY ./core/requirements.txt ./requirements.txt | |
RUN pip install -r requirements.txt | |
# Copy the core files | |
COPY ./core . | |
# Set the PYTHONPATH to include the /app/core directory | |
ENV PYTHONPATH="/app/core" | |
# Run the initialization script to load and serialize the dataset | |
RUN python initialization.py | |
# Second stage: Set up the API | |
FROM python:3.9 | |
# Set the working directory | |
WORKDIR /app/api | |
# Copy and install API requirements | |
COPY ./api/requirements.txt ./requirements.txt | |
RUN pip install -r requirements.txt | |
# Copy the API files | |
COPY ./api . | |
# Copy the serialized engine from the first stage | |
COPY --from=core /app/core/engine.pickle /app/api/engine.pickle | |
# Expose the API port | |
EXPOSE 9999 | |
# Run the service manager | |
ENTRYPOINT ["python", "service_manager.py"] | |
# FROM python:3.9 as core | |
# | |
# COPY ./core/requirements.txt ./requirements.txt | |
# RUN pip install -r requirements.txt | |
# | |
# WORKDIR /app/core | |
# | |
# COPY ./core . | |
# RUN python ./initialization.py | |
# | |
# FROM python:3.9 | |
# | |
# COPY ./api/requirements.txt ./requirements.txt | |
# RUN pip install -r requirements.txt | |
# | |
# WORKDIR /app/api | |
# COPY ./api . | |
# | |
# COPY --from=core /app/engine.pickle /app/engine.pickle | |
# | |
# EXPOSE 9999 | |
# ENTRYPOINT ["python", "service_manager.py"] | |
# FROM python:3.9 as build | |
# | |
# COPY ./requirements.txt ./requirements.txt | |
# RUN pip install -r requirements.txt | |
# | |
# WORKDIR /app | |
# | |
# COPY . . | |
# | |
# RUN mkdir -p /app/cache && chmod -R 777 /app/cache | |
# | |
# ENV TRANSFORMERS_CACHE=/app/cache | |
# | |
# EXPOSE 9999 | |
# ENTRYPOINT ["python", "run.py"] | |