Gemma4 / Dockerfile
simler's picture
Update Dockerfile
3aa5d4f verified
Raw
History Blame Contribute Delete
767 Bytes
FROM python:3.10-slim
# 1. 终极完全体:把 gcc 编译器 (build-essential) 和 多核库 (libgomp1) 全部带上!
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
curl \
libgomp1 \
&& rm -rf /var/lib/apt/lists/*
RUN useradd -m -u 1000 user
USER user
ENV HOME=/home/user \
PATH=/home/user/.local/bin:$PATH
WORKDIR $HOME/app
COPY --chown=user requirements.txt .
# 2. 🌟 绝对防御:强行限制编译线程数为 2!就算它自己编译,也绝对不会再爆内存!
ENV CMAKE_BUILD_PARALLEL_LEVEL=2
# 3. 卸下伪装,直接从官方拉取最新源码进行安全编译
RUN pip install --no-cache-dir -r requirements.txt
COPY --chown=user app.py .
EXPOSE 7860
CMD ["python", "app.py"]