Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@

# syntax=docker/dockerfile:1
FROM python:3.12-slim

# システム依存パッケージのインストール
RUN apt-get update && \
apt-get install -y --no-install-recommends \
build-essential \
cmake \
git \
&& rm -rf /var/lib/apt/lists/*

# キャッシュディレクトリ作成と権限付与
RUN mkdir -p /root/.cache/openai-harmony && chmod -R 777 /root/.cache
ENV OPENAI_HARMONY_CACHE_DIR=/root/.cache/openai-harmony

# 作業ディレクトリの作成
WORKDIR /app

# プロジェクトファイルのコピー
COPY . /app

# Python依存パッケージのインストール(公式ガイド+transformers明示的追加+openai-harmony最新版)
RUN pip install --upgrade pip setuptools requests certifi && \
pip install openai-harmony --upgrade && \
pip install .[torch] && \
pip install transformers && \
apt-get update && apt-get install -y curl && \
curl -fSL -o /root/.cache/openai-harmony/harmony-gpt-oss.tiktoken https://openaipublic.blob.core.windows.net/harmony/v1/harmony-gpt-oss.tiktoken

# vocabダウンロードスクリプトをコピー
COPY download_vocab.sh /download_vocab.sh
RUN chmod +x /download_vocab.sh

# ポート番号(必要に応じて変更)
EXPOSE 8000

# サーバー起動例(transformersバックエンド指定)
ENTRYPOINT ["/download_vocab.sh"]
CMD ["python", "-m", "gpt_oss.responses_api.serve", "--inference-backend", "transformers"]
10 changes: 10 additions & 0 deletions download_vocab.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash
set -ex

# vocabファイルがなければダウンロード(失敗しても起動は継続)
python -c "from openai_harmony import load_harmony_encoding, HarmonyEncodingName; load_harmony_encoding(HarmonyEncodingName.HARMONY_GPT_OSS)" || true

# キャッシュディレクトリの中身を表示
ls -l /root/.cache/openai-harmony || true

exec "$@"