File size: 944 Bytes
448b8e7 9466a36 448b8e7 c7f2377 448b8e7 c7f2377 448b8e7 9466a36 c7f2377 448b8e7 c7f2377 448b8e7 c7f2377 448b8e7 c7f2377 448b8e7 9466a36 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | # We use a base image that has Python installed
FROM python:3.9-slim
# Install Node.js (for the website) and system tools
RUN apt-get update && apt-get install -y curl build-essential && \
curl -fsSL https://deb.nodesource.com/setup_18.x | bash - && \
apt-get install -y nodejs && \
rm -rf /var/lib/apt/lists/*
WORKDIR /app
# 1. Install Python Dependencies (The AI Brain)
# We install these libraries to talk to the GPU
RUN pip install flask flask-cors torch diffusers transformers accelerate sentencepiece protobuf --extra-index-url https://download.pytorch.org/whl/cu118
# 2. Install Node Dependencies (The Website)
COPY package*.json ./
RUN npm install
# 3. Copy Code
COPY . .
# 4. OPTIMIZATION: Set cache to persistent storage [Cite: 7]
ENV HF_HOME=/data/.huggingface
# 5. Build Website
RUN npm run build
# 6. Open Port
EXPOSE 7860
# 7. Start both servers
CMD ["sh", "-c", "python3 ai_server.py & npm start -- -p 7860"] |