Spaces:
Running
Running
FROM python:3.11-slim | |
WORKDIR /usr/src/app | |
COPY . . | |
RUN pip install --no-cache-dir -r requirements.txt | |
EXPOSE 7860 | |
ENV GRADIO_SERVER_NAME="0.0.0.0" | |
# Get service account key from HF Spaces' secrets | |
# https://huggingface.co/docs/hub/spaces-sdks-docker#buildtime | |
RUN --mount=type=secret,id=GCLOUD_SA_JSON,mode=0444,required=true \ | |
cat /run/secrets/GCLOUD_SA_JSON > /usr/src/app/credentials.json | |
RUN --mount=type=secret,id=GCLOUD_OBJECT_SA_JSON,mode=0444,required=true \ | |
cat /run/secrets/GCLOUD_OBJECT_SA_JSON > /usr/src/app/credentials_object.json | |
RUN --mount=type=secret,id=BUCKET_NAME,mode=0444,required=true \ | |
--mount=type=secret,id=CLI_OBJECT_NAME,mode=0444,required=true \ | |
python download_gcs_object.py --bucket-name $(cat /run/secrets/BUCKET_NAME) --object-name $(cat /run/secrets/CLI_OBJECT_NAME) | |
RUN --mount=type=secret,id=CLI_OBJECT_NAME,mode=0444,required=true \ | |
tar -xf $(cat /run/secrets/CLI_OBJECT_NAME) | |
CMD ["python", "app.py"] |