File size: 1,808 Bytes
d0da068
 
 
 
 
 
 
866a3e6
d0da068
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
e0ec2f8
d0da068
 
 
04cec24
eb6990d
 
 
f675396
 
eb6990d
d0da068
eb6990d
d0da068
 
7530640
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
56
57
58
59
60
61
62
# ベースイメージを指定
FROM python:3.10@sha256:ace6953906f89f6284daacd2c7addc351bf338629d89a8bb07f2a38bf38f301b

# pip と必要パッケージをインストール
RUN pip install --no-cache-dir -U pip && \
    pip install --no-cache-dir \
        datasets \
        "huggingface-hub==1.0.0rc6" \
        "protobuf<4" \
        "click<8.1" \
        "pydantic==2.10.6"

# 基本ユーティリティのインストール
RUN apt-get update && apt-get install -y \
        git \
        git-lfs \
        ffmpeg \
        libsm6 \
        libxext6 \
        cmake \
        rsync \
        libgl1 && \
    rm -rf /var/lib/apt/lists/* && \
    git lfs install

# fakeroot の設定とユーザー追加
RUN apt-get update && apt-get install -y fakeroot && \
    mv /usr/bin/apt-get /usr/bin/.apt-get && \
    echo '#!/usr/bin/env sh\nfakeroot /usr/bin/.apt-get "$@"' > /usr/bin/apt-get && \
    chmod +x /usr/bin/apt-get && \
    rm -rf /var/lib/apt/lists/* && \
    useradd -m -u 1000 user

# Node.js 20.x のインストール
RUN apt-get update && apt-get install -y curl && \
    curl -fsSL https://deb.nodesource.com/setup_20.x | bash - && \
    apt-get install -y nodejs && \
    rm -rf /var/lib/apt/lists/* && \
    apt-get clean

# 作業ディレクトリ設定
WORKDIR /home/user/app

# requirements.txt をコピーしてインストール
COPY requirements.txt /tmp/requirements.txt
RUN pip install --use-deprecated=legacy-resolver --no-cache-dir -r /tmp/requirements.txt

# アプリケーションファイルをコピー
COPY . /home/user/app
EXPOSE 7860

RUN mkdir -p ./models
RUN chmod -R 777 ./models
RUN mkdir -p /home/user/app
RUN chmod -R 777 /home/user/app

# 非rootユーザーで実行
USER root

# 起動コマンド(app.pyを実行)
CMD ["python", "app_optimized.py"]