Spaces:
Running
Running
| # ベースイメージを指定 | |
| 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"] | |