Spaces:
Runtime error
Runtime error
| # ベースイメージとしてPython 3.11.7を使用 | |
| FROM python:3.11.7-slim | |
| # 作業ディレクトリを設定 | |
| WORKDIR /code | |
| # requirements.txtをコンテナにコピー | |
| COPY ./requirements.txt /code/requirements.txt | |
| # 依存関係をインストール | |
| RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt | |
| # git をインストール | |
| RUN apt-get update && apt-get install -y git | |
| # シークレット情報をクローンに使用 | |
| # SECRET_GIT_TOKEN は Docker のシークレットとして設定したもの | |
| RUN --mount=type=secret,id=ghKey,mode=0444,required=true \ | |
| git clone https://$(cat /run/secrets/ghKey)@github.com/OzoneAsai/flashcards.git | |
| # ソースコード全体をコンテナにコピー | |
| COPY . . | |
| RUN chmod -R 777 ./flashcards | |
| RUN cd ./flashcards | |
| WORKDIR /code/flashcards | |
| RUN --mount=type=secret,id=GEMINI_API_KEY,mode=0444,required=true \ | |
| echo "GEMINI_API_KEY=$(cat /run/secrets/GEMINI_API_KEY)" >> .env | |
| # アプリケーションの起動 | |
| CMD ["python3", "app.py"] | |