ARG PYTHON_VERSION=3.10.13 | |
FROM python:${PYTHON_VERSION}-slim AS base | |
# Install necessary packages including pipenv | |
RUN apt-get update && \ | |
apt-get install -y pipenv && \ | |
rm -rf /var/lib/apt/lists/* | |
ENV PORT=7860 | |
# Set Pipenv to create the virtual environment in the project directory | |
ENV PIPENV_VENV_IN_PROJECT=1 | |
WORKDIR /app | |
# RUN mkdir -p /tmp/data && chmod -R 755 /tmp/data | |
# Copy the requirements file | |
COPY requirements.txt . | |
# Install dependencies into a pipenv environment within the project | |
RUN pipenv install --dev --ignore-pipfile | |
# Copy the rest of the application code | |
COPY . . | |
# Expose the application port | |
EXPOSE 7860 | |
# Ensure Python is installed correctly | |
RUN python -V | |
# Run the application using pipenv | |
CMD pipenv run python -m gunicorn main:app -b 0.0.0.0:7860 -w 8 --timeout 600 | |
# ARG PYTHON_VERSION=3.10.13 | |
# FROM python:${PYTHON_VERSION}-slim AS base | |
# RUN apt-get update && apt-get install -y sudo && rm -rf /var/lib/apt/lists/* | |
# ENV PORT=7860 | |
# RUN ls | |
# WORKDIR /app | |
# RUN ls | |
# copy requirements.txt . | |
# RUN python -m pip install --upgrade pip | |
# RUN python -m pip install -r requirements.txt | |
# COPY . . | |
# EXPOSE 7860 | |
# RUN python -V | |
# CMD sudo python -m gunicorn main:app -b 0.0.0.0:7860 -w 8 --timeout 600 |