Skip to content

Commit

Permalink
Update Dockerfile to use Python 3.10 and install project dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
VikramxD committed Nov 7, 2024
1 parent c8209bc commit 72d2ad2
Showing 1 changed file with 26 additions and 22 deletions.
48 changes: 26 additions & 22 deletions DockerFileFolder/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,48 +1,52 @@
# Change CUDA and cuDNN version here
FROM nvidia/cuda:12.4.1-cudnn-runtime-ubuntu20.04
ARG PYTHON_VERSION=3.12
ARG PYTHON_VERSION=3.10

ENV DEBIAN_FRONTEND=noninteractive

# Install Python and dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
software-properties-common \
wget \
git \
curl \
build-essential \
&& add-apt-repository ppa:deadsnakes/ppa \
&& apt-get update && apt-get install -y --no-install-recommends \
python$PYTHON_VERSION \
python$PYTHON_VERSION-dev \
python$PYTHON_VERSION-venv \
python${PYTHON_VERSION} \
python${PYTHON_VERSION}-dev \
python${PYTHON_VERSION}-venv \
python3-pip \
&& wget https://bootstrap.pypa.io/get-pip.py -O get-pip.py \
&& python$PYTHON_VERSION get-pip.py \
&& python${PYTHON_VERSION} get-pip.py \
&& rm get-pip.py \
&& ln -sf /usr/bin/python$PYTHON_VERSION /usr/bin/python \
&& ln -sf /usr/local/bin/pip$PYTHON_VERSION /usr/local/bin/pip \
&& python --version \
&& pip --version \
&& apt-get purge -y --auto-remove software-properties-common \
&& ln -sf /usr/bin/python${PYTHON_VERSION} /usr/bin/python3 \
&& ln -sf /usr/bin/python${PYTHON_VERSION} /usr/bin/python \
&& ln -sf /usr/bin/pip3 /usr/bin/pip \
&& python3 --version \
&& pip3 --version \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

# Copy everything from DockerFileFolder and the rest of the directory structure
COPY DockerFileFolder/ /app/DockerFileFolder/
COPY src/ /app/src/
COPY requirements.txt /app/

# Set working directory
WORKDIR /app

# Copy everything
COPY . .

# Install project dependencies
RUN pip install uv
RUN uv pip install --no-cache-dir -r requirements.txt
RUN uv pip install -e . --no-build-isolation
# Install dependencies
RUN pip3 install --no-cache-dir -r requirements.txt

# Create log directory if it doesn't exist
RUN mkdir -p src/api/logs

# Set working directory for the server
WORKDIR /app/src/api
RUN mkdir -p /app/src/api/logs

# Expose port
EXPOSE 8000

# Set working directory for the server
WORKDIR /app/src/api

# Command to run the server
CMD ["python", "mochi_serve.py"]
CMD ["python3", "mochi_serve.py"]

0 comments on commit 72d2ad2

Please sign in to comment.