-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
46 lines (38 loc) · 1.08 KB
/
Dockerfile
File metadata and controls
46 lines (38 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
FROM nvidia/cuda:11.2.2-cudnn8-runtime-ubuntu20.04
# Install dependencies
RUN apt-get update && \
apt-get install -y --no-install-recommends \
python3-pip \
python3-dev \
python3-venv \
libsm6 \
libxext6 \
libxrender-dev \
libglib2.0-0 \
libgl1-mesa-glx \
libgomp1 && \
rm -rf /var/lib/apt/lists/*
# Set the working directory
WORKDIR /app
# Copy the requirements file
COPY requirements.txt /app/requirements.txt
# Create a virtual environment and install Python dependencies
RUN python3 -m venv /opt/venv && \
. /opt/venv/bin/activate && \
pip install --upgrade pip && \
pip install setuptools wheel && \
pip install -r requirements.txt
# Copy the application code
COPY . /app
# Set environment variables
ENV PATH="/opt/venv/bin:$PATH" \
PYTHONUNBUFFERED=1 \
PYTHONDONTWRITEBYTECODE=1 \
NVIDIA_VISIBLE_DEVICES=all \
NVIDIA_DRIVER_CAPABILITIES=compute,utility \
TF_CPP_MIN_LOG_LEVEL=2 \
TF_ENABLE_ONEDNN_OPTS=0
# Expose the port the app runs on
EXPOSE 5000
# Command to run the application
CMD ["python3", "main.py"]