gemini-web2api / Dockerfile
RYUK999's picture
fix: make workdir writable for config/cookie generation at runtime
a7fbd75
Raw
History Blame Contribute Delete
847 Bytes
FROM python:3.12-slim
# Hugging Face Spaces expect a non-root user with UID 1000
RUN useradd -m -u 1000 user
WORKDIR /home/user/app
# Python deps
COPY --chown=user requirements.txt .
RUN pip install --no-cache-dir --upgrade pip \
&& pip install --no-cache-dir -r requirements.txt
# App source
COPY --chown=user gemini_web2api.py ./gemini_web2api.py
COPY --chown=user gemini_web2api ./gemini_web2api
COPY --chown=user config.example.json ./config.example.json
COPY --chown=user run.py ./run.py
# Workdir is created by WORKDIR as root: make it writable by `user`
# so run.py can generate config.json / cookie.txt at runtime
RUN chown -R user:user /home/user/app
# HF Spaces must serve on port 7860
ENV PORT=7860 \
HOST=0.0.0.0 \
HOME=/home/user \
PATH=/home/user/.local/bin:$PATH
USER user
EXPOSE 7860
CMD ["python", "run.py"]