-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
50 lines (46 loc) · 1.47 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
FROM nvidia/cuda:11.8.0-cudnn8-devel-ubuntu22.04
# `tzdata` requires noninteractive mode.
ARG DEBIAN_FRONTEND=noninteractive
ARG PYTHON_VERSION=3.9
ARG APP_DIR="/app"
ENV LANG=C.UTF-8 \
LC_ALL=C.UTF-8 \
TZ=Asia/Tokyo \
PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1 \
PYTHONIOENCODING=UTF-8 \
# pip:
PIP_DEFAULT_TIMEOUT=100 \
PIP_NO_CACHE_DIR=on \
PIP_DISABLE_PIP_VERSION_CHECK=on \
# poetry:
POETRY_NO_INTERACTION=1 \
DEB_PYTHON_INSTALL_LAYOUT=deb \
APP_DIR=${APP_DIR} \
PYTHONPATH=${APP_DIR}/src:$PYTHONPATH
# Install system dependencies
RUN apt update \
&& apt install -y --no-install-recommends \
curl \
wget \
software-properties-common
# Install python and poetry
RUN add-apt-repository ppa:deadsnakes/ppa \
&& apt update \
&& apt install -y python${PYTHON_VERSION}-dev python3-pip python${PYTHON_VERSION}-distutils \
&& apt clean \
&& rm -rf /var/lib/apt/lists/* \
&& unlink /usr/bin/python3 \
&& ln -s /usr/bin/python${PYTHON_VERSION} /usr/bin/python3
# Install poetry
RUN curl -sSL https://install.python-poetry.org | python3 - -yfp \
&& cd /usr/local/bin \
&& ln -s /root/.local/bin/poetry \
&& poetry config virtualenvs.create false \
&& poetry config installer.max-workers 10
WORKDIR ${APP_DIR}
COPY pyproject.toml poetry.lock ./
RUN poetry export --without-hashes --no-interaction --no-ansi -f requirements.txt -o requirements.txt \
&& pip3 install --force-reinstall -r requirements.txt
COPY . .
CMD ["/bin/bash"]