-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update Dockerfile to use Python 3.10 and install project dependencies
- Loading branch information
Showing
1 changed file
with
26 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"] |