Skip to content

Commit a1cbab3

Browse files
authored
Merge pull request #35 from nglcobdai/dev
[v1.2.0] GPU環境の修正
2 parents 1987f5e + e2928b1 commit a1cbab3

File tree

7 files changed

+1252
-1100
lines changed

7 files changed

+1252
-1100
lines changed

Dockerfile.dev

Lines changed: 12 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,38 @@
1-
FROM ubuntu:22.04
1+
FROM nvidia/cuda:12.1.0-cudnn8-runtime-ubuntu22.04
22

33
ENV LANG=C.UTF-8 \
44
LANGUAGE=en_US \
5-
PYTHONPATH="/root/workspace/app:$PYTHONPATH" \
5+
PYTHONPATH="/root/workspace:$PYTHONPATH" \
66
DEBIAN_FRONTEND=noninteractive
77

8-
# 基本ツールのインストール
9-
RUN apt-get update && apt-get install -y wget gnupg software-properties-common \
10-
&& rm -rf /var/lib/apt/lists/*
11-
128
# Pythonのインストール
139
RUN apt-get update && apt-get install -y python3.10 python3-pip \
1410
&& ln -s /usr/bin/python3.10 /usr/bin/python \
1511
&& rm -rf /var/lib/apt/lists/*
1612

17-
# CUDAをインストール
18-
RUN wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/cuda-ubuntu2204.pin \
19-
&& mv cuda-ubuntu2204.pin /etc/apt/preferences.d/cuda-repository-pin-600
20-
RUN apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/3bf863cc.pub
21-
RUN add-apt-repository "deb https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/ /" \
22-
&& apt-get update
23-
RUN apt-get install -y cuda-12-4 \
24-
&& rm -rf /var/lib/apt/lists/*
25-
ENV LD_LIBRARY_PATH="/usr/local/cuda-12.4/lib64:$LD_LIBRARY_PATH" \
26-
PATH="/usr/local/cuda-12.4/bin:$PATH"
27-
2813
# システム依存のライブラリをインストール
29-
RUN apt-get update && apt-get install -y libgl1-mesa-glx \
14+
RUN apt-get update && apt-get install -y \
15+
libgl1-mesa-glx \
3016
&& rm -rf /var/lib/apt/lists/*
3117

3218
WORKDIR /root/workspace
3319

34-
# pyproject.toml、poetry.lock、poetry.tomlをコピーする
35-
COPY pyproject.toml poetry.lock poetry.toml $WORKDIR/
36-
3720
# Poetryのインストールと依存関係のインストール
3821
RUN pip install --no-cache-dir --upgrade pip \
3922
&& pip install --upgrade poetry
4023

24+
# pyproject.toml、poetry.lock、poetry.tomlをコピーする
25+
COPY pyproject.toml poetry.lock poetry.toml $WORKDIR/
26+
27+
RUN poetry install --no-root
28+
4129
# Temporary directory for Poetry and torch installation
4230
ENV TMPDIR=/root/workspace/tmp
4331
RUN mkdir -p $TMPDIR
4432

33+
# OpenAI-Whisperに必要なライブラリをインストール
34+
RUN apt-get update && apt-get install -y ffmpeg
35+
4536
# Clear cache to free up space
4637
RUN apt-get clean \
4738
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
48-
49-
RUN poetry install --no-root
50-
51-
# OpenAI-Whisperに必要なライブラリをインストール
52-
RUN apt-get update && apt-get install -y ffmpeg \
53-
&& rm -rf /var/lib/apt/lists/*

Dockerfile.prod

Lines changed: 11 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,38 @@
1-
FROM ubuntu:22.04
1+
FROM nvidia/cuda:12.1.0-cudnn8-runtime-ubuntu22.04
22

33
ENV LANG=C.UTF-8 \
44
LANGUAGE=en_US \
5-
PYTHONPATH="/root/workspace/app:$PYTHONPATH" \
5+
PYTHONPATH="/root/workspace:$PYTHONPATH" \
66
DEBIAN_FRONTEND=noninteractive
77

8-
# 基本ツールのインストール
9-
RUN apt-get update && apt-get install -y wget gnupg software-properties-common \
10-
&& rm -rf /var/lib/apt/lists/*
11-
128
# Pythonのインストール
139
RUN apt-get update && apt-get install -y python3.10 python3-pip \
1410
&& ln -s /usr/bin/python3.10 /usr/bin/python \
1511
&& rm -rf /var/lib/apt/lists/*
1612

17-
# CUDAをインストール
18-
RUN wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/cuda-ubuntu2204.pin \
19-
&& mv cuda-ubuntu2204.pin /etc/apt/preferences.d/cuda-repository-pin-600
20-
RUN apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/3bf863cc.pub
21-
RUN add-apt-repository "deb https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/ /" \
22-
&& apt-get update
23-
RUN apt-get install -y cuda-12-4 \
24-
&& rm -rf /var/lib/apt/lists/*
25-
ENV LD_LIBRARY_PATH="/usr/local/cuda-12.4/lib64:$LD_LIBRARY_PATH" \
26-
PATH="/usr/local/cuda-12.4/bin:$PATH"
27-
2813
# システム依存のライブラリをインストール
29-
RUN apt-get update && apt-get install -y libgl1-mesa-glx \
14+
RUN apt-get update && apt-get install -y \
15+
libgl1-mesa-glx \
3016
&& rm -rf /var/lib/apt/lists/*
3117

3218
WORKDIR /root/workspace
3319

34-
# pyproject.toml、poetry.lock、poetry.tomlをコピーする
35-
COPY pyproject.toml poetry.lock poetry.toml $WORKDIR/
36-
3720
# Poetryのインストールと依存関係のインストール
3821
RUN pip install --no-cache-dir --upgrade pip \
3922
&& pip install --upgrade poetry
4023

24+
# pyproject.toml、poetry.lock、poetry.tomlをコピーする
25+
COPY pyproject.toml poetry.lock poetry.toml $WORKDIR/
26+
27+
RUN poetry install --no-root --no-dev
28+
4129
# Temporary directory for Poetry and torch installation
4230
ENV TMPDIR=/root/workspace/tmp
4331
RUN mkdir -p $TMPDIR
4432

45-
# Poetry cache clear
46-
RUN poetry cache clear pypi --all --no-interaction \
47-
&& poetry cache clear cache --all --no-interaction
33+
# OpenAI-Whisperに必要なライブラリをインストール
34+
RUN apt-get update && apt-get install -y ffmpeg
4835

4936
# Clear cache to free up space
5037
RUN apt-get clean \
5138
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
52-
53-
# Poetryの依存関係インストール
54-
RUN poetry install --no-root --no-dev
55-
56-
# OpenAI-Whisperに必要なライブラリをインストール
57-
RUN apt-get update && apt-get install -y ffmpeg \
58-
&& rm -rf /var/lib/apt/lists/*

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ It is intended to be used in combination with [Auto Unlock App](https://github.c
77
| | |
88
| --------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
99
| **License** | ![LICENSE](https://img.shields.io/badge/license-MIT-blue.svg?style=flat) |
10-
| **Environment** | ![Ubuntu](https://img.shields.io/badge/-Ubuntu_22.04_LTS-fad9c1.svg?logo=ubuntu&style=flat) <br> ![Docker](https://img.shields.io/badge/-Docker_v26.0.2-0055a4.svg?logo=docker&style=flat) ![Docker Compose](https://img.shields.io/badge/-Docker_Compose_v2.22.0-0055a4.svg?logo=docker&style=flat) <br> ![CUDA](https://img.shields.io/badge/-CUDA_12.5-a4d17c.svg?logo=nvidia&style=flat) ![Python](https://img.shields.io/badge/-Python_3.10-F9DC3E.svg?logo=python&style=flat) |
10+
| **Environment** | ![Ubuntu](https://img.shields.io/badge/-Ubuntu_22.04_LTS-fad9c1.svg?logo=ubuntu&style=flat) <br> ![Docker](https://img.shields.io/badge/-Docker_v26.0.2-0055a4.svg?logo=docker&style=flat) ![Docker Compose](https://img.shields.io/badge/-Docker_Compose_v2.22.0-0055a4.svg?logo=docker&style=flat) <br> ![CUDA](https://img.shields.io/badge/-CUDA_12.1-a4d17c.svg?logo=nvidia&style=flat) ![Python](https://img.shields.io/badge/-Python_3.10-F9DC3E.svg?logo=python&style=flat) |
1111
| **Technology** | ![Poetry](https://img.shields.io/badge/-Poetry-2c2d72.svg?logo=python&style=flat) ![FastAPI](https://img.shields.io/badge/-FastAPI-80cbc4.svg?logo=fastapi&style=flat) ![MongoDB](https://img.shields.io/badge/-MongoDB-2e5235.svg?logo=mongodb&style=flat) <br> ![OpenAI-Whisper](https://img.shields.io/badge/-OpenAI_Whisper-e40084.svg?logo=openai&style=flat) ![SwitchBot API](https://img.shields.io/badge/-SwitchBot_API_v1.1-fc6203.svg?logo=SwitchBot&style=flat) |
1212
| |
1313

@@ -18,7 +18,7 @@ It is intended to be used in combination with [Auto Unlock App](https://github.c
1818
- `Docker`: `v26.0.2`
1919
- `Docker Compose`: `v2.22.0`
2020

21-
- CUDA is required.
21+
- Nvidia Driver is required for CUDA `12.1`.
2222

2323
- Whisper model is used. Please refer to the official [github](https://github.com/openai/whisper) for the device requirements.
2424

docker-compose.dev.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,9 @@ services:
2525
resources:
2626
reservations:
2727
devices:
28-
- capabilities: [gpu]
28+
- driver: nvidia
29+
count: all
30+
capabilities: [gpu]
2931

3032
mongodb:
3133
image: mongo:5.0.4

docker-compose.prod.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,9 @@ services:
2525
resources:
2626
reservations:
2727
devices:
28-
- capabilities: [gpu]
28+
- driver: nvidia
29+
count: all
30+
capabilities: [gpu]
2931

3032
mongodb:
3133
image: mongo:5.0.4

0 commit comments

Comments
 (0)