termix / Dockerfile
lekmikdok's picture
Prepare Terax for web deployment
50fe3c9 verified
Raw
History Blame Contribute Delete
724 Bytes
# Build stage
FROM node:20-slim AS build
WORKDIR /app
COPY package.json pnpm-lock.yaml ./
RUN npm install -g pnpm && pnpm install
COPY . .
ENV VITE_HF_DEPLOY=true
RUN pnpm build
# Runtime stage
FROM python:3.12-slim
WORKDIR /app
RUN apt-get update && apt-get install -y \
bash \
curl \
git \
procps \
&& rm -rf /var/lib/apt/lists/*
COPY --from=build /app/dist ./dist
COPY server.py .
RUN pip install fastapi uvicorn httpx python-multipart
# Hugging Face runs as user 1000
RUN useradd -m -u 1000 user
USER user
ENV HOME=/home/user \
PATH=/home/user/.local/bin:$PATH
WORKDIR /home/user/app
COPY --chown=user . .
COPY --from=build --chown=user /app/dist ./dist
EXPOSE 7860
CMD ["python", "server.py"]