-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile
55 lines (43 loc) · 1.69 KB
/
Dockerfile
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
47
48
49
50
51
52
53
54
55
# Use specific version of nvidia cuda image
FROM nvidia/cuda:11.8.0-cudnn8-runtime-ubuntu22.04
# Remove any third-party apt sources to avoid issues with expiring keys.
RUN rm -f /etc/apt/sources.list.d/*.list
# Set shell and noninteractive environment variables
SHELL ["/bin/bash", "-c"]
ENV DEBIAN_FRONTEND=noninteractive
ENV SHELL=/bin/bash
# Set working directory
WORKDIR /
# Update and upgrade the system packages (Worker Template)
RUN apt-get update -y && \
apt-get upgrade -y && \
apt-get install --yes --no-install-recommends sudo ca-certificates git wget curl bash libgl1 libx11-6 software-properties-common ffmpeg build-essential -y &&\
apt-get autoremove -y && \
apt-get clean -y && \
rm -rf /var/lib/apt/lists/*
# Add the deadsnakes PPA and install Python 3.10
RUN add-apt-repository ppa:deadsnakes/ppa -y && \
apt-get install python3.10-dev python3.10-venv python3-pip -y --no-install-recommends && \
ln -s /usr/bin/python3.10 /usr/bin/python && \
rm /usr/bin/python3 && \
ln -s /usr/bin/python3.10 /usr/bin/python3 && \
apt-get autoremove -y && \
apt-get clean -y && \
rm -rf /var/lib/apt/lists/*
# Download and install pip
RUN curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py && \
python get-pip.py && \
rm get-pip.py
# Install Python dependencies (Worker Template)
COPY requirements.txt /requirements.txt
RUN --mount=type=cache,target=/root/.cache/pip \
pip install --upgrade pip && \
pip install -r /requirements.txt --no-cache-dir && \
rm /requirements.txt
COPY . /usr/src/app
WORKDIR /usr/src/app
# Load models to image
RUN chmod +x scripts/build.sh
RUN ./scripts/build.sh
RUN chmod +x scripts/start.sh
CMD ["./scripts/start.sh"]