Spaces:
Running
Running
github-actions[bot] commited on
Commit ·
7b6257f
1
Parent(s): 2f527e1
deploy: 54f2c22 — 更新 Dockerfile.huggingface
Browse files- Dockerfile +28 -100
- Dockerfile.huggingface +28 -100
Dockerfile
CHANGED
|
@@ -1,138 +1,66 @@
|
|
| 1 |
-
#
|
| 2 |
-
#
|
| 3 |
#
|
| 4 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
#
|
| 6 |
-
#
|
| 7 |
-
#
|
| 8 |
-
#
|
| 9 |
-
#
|
| 10 |
-
# │ / → static frontend files │
|
| 11 |
-
# │ /api/* → localhost:3001 (backend) │
|
| 12 |
-
# │ /v1/* → localhost:4000 (litellm) │
|
| 13 |
-
# └──────────────────────────────────────────┘
|
| 14 |
-
# │ │
|
| 15 |
-
# ▼ ▼
|
| 16 |
-
# Node.js backend LiteLLM proxy
|
| 17 |
-
# (port 3001) (port 4000)
|
| 18 |
-
# │
|
| 19 |
-
# ▼
|
| 20 |
-
# SQLite /app/data/gateway.db
|
| 21 |
-
#
|
| 22 |
-
# All processes are managed by supervisord.
|
| 23 |
-
#
|
| 24 |
-
# Bug fixes applied:
|
| 25 |
-
# [Bug2] Added build-essential so better-sqlite3 can compile via node-gyp
|
| 26 |
-
# if the prebuilt binary download fails.
|
| 27 |
-
# [Bug3] Changed `npm ci --only=production` → `npm install --omit=dev`
|
| 28 |
-
# (--only=production is deprecated since npm v7; Node 20 ships npm v10).
|
| 29 |
-
# [Bug5] LiteLLM pip version extracted to ARG LITELLM_VERSION so it stays
|
| 30 |
-
# in sync with docker-compose.yml without touching two separate lines.
|
| 31 |
-
# ─────────────────────────────────────────────────────────────────────────────
|
| 32 |
|
| 33 |
-
# ── Stage 1: Build React frontend ─────────────────────────────────────────────
|
| 34 |
FROM node:20-alpine AS frontend-builder
|
| 35 |
-
|
| 36 |
WORKDIR /build
|
| 37 |
-
|
| 38 |
-
# Build args match the original frontend/Dockerfile
|
| 39 |
ARG VITE_API_BASE=/api
|
| 40 |
ARG VITE_APP_NAME="AI Gateway Hub"
|
| 41 |
-
ENV VITE_API_BASE=$VITE_API_BASE
|
| 42 |
-
VITE_APP_NAME=$VITE_APP_NAME
|
| 43 |
-
|
| 44 |
-
# Layer-cache package install separately from source copy
|
| 45 |
COPY frontend/package*.json ./
|
| 46 |
RUN npm install
|
| 47 |
-
|
| 48 |
COPY frontend/ .
|
| 49 |
RUN npm run build
|
| 50 |
|
| 51 |
-
# ── Stage 2: Production runtime ───────────────────────────────────────────────
|
| 52 |
FROM python:3.11-slim
|
| 53 |
|
| 54 |
-
|
| 55 |
-
# docker-compose.yml: ghcr.io/berriai/litellm:main-v1.81.14-stable
|
| 56 |
-
# → PyPI package: litellm==1.81.14
|
| 57 |
-
# To upgrade: change both this ARG and the docker-compose image tag together.
|
| 58 |
-
ARG LITELLM_VERSION=1.50.4
|
| 59 |
|
| 60 |
-
# ── System deps ───────────────────────────────────────────────────────────────
|
| 61 |
-
# build-essential (make + g++) is required as a fallback compilation path for
|
| 62 |
-
# better-sqlite3. prebuild-install downloads a prebuilt .node binary at npm ci
|
| 63 |
-
# time; if that download fails (version mismatch, network timeout, etc.) the
|
| 64 |
-
# package falls back to compiling from source via node-gyp, which needs make
|
| 65 |
-
# and g++. Without build-essential that fallback path crashes the build.
|
| 66 |
RUN apt-get update && apt-get install -y --no-install-recommends \
|
| 67 |
-
curl \
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
build-essential \
|
| 73 |
-
&& \
|
| 74 |
-
# Node.js 20 LTS (backend runtime — frontend is pre-built in Stage 1)
|
| 75 |
-
curl -fsSL https://deb.nodesource.com/setup_20.x | bash - && \
|
| 76 |
-
apt-get install -y --no-install-recommends nodejs && \
|
| 77 |
-
# Clean up (gnupg no longer needed after nodesource setup)
|
| 78 |
-
apt-get purge -y gnupg && \
|
| 79 |
-
apt-get autoremove -y && \
|
| 80 |
-
rm -rf /var/lib/apt/lists/*
|
| 81 |
|
| 82 |
-
# ── LiteLLM proxy ─────────────────────────────────────────────────────────────
|
| 83 |
RUN pip install --no-cache-dir "litellm[proxy]==${LITELLM_VERSION}"
|
| 84 |
|
| 85 |
-
# ── Non-root user (HF Spaces recommendation: uid=1000) ────────────────────────
|
| 86 |
RUN useradd -m -u 1000 -s /bin/bash user
|
| 87 |
|
| 88 |
-
# ── Directory layout ──────────────────────────────────────────────────────────
|
| 89 |
RUN mkdir -p \
|
| 90 |
-
/app/frontend/dist \
|
| 91 |
-
/app/
|
| 92 |
-
/app/litellm \
|
| 93 |
-
/app/huggingface \
|
| 94 |
-
/app/data \
|
| 95 |
-
/var/log/supervisor \
|
| 96 |
-
/tmp/nginx/client_body \
|
| 97 |
-
/tmp/nginx/proxy \
|
| 98 |
-
/tmp/nginx/fastcgi \
|
| 99 |
-
/tmp/nginx/uwsgi \
|
| 100 |
-
/tmp/nginx/scgi \
|
| 101 |
-
&& \
|
| 102 |
-
# Give nginx writable log/lib dirs when running as uid 1000
|
| 103 |
-
chown -R user:user \
|
| 104 |
-
/app \
|
| 105 |
/var/log/supervisor \
|
| 106 |
-
/
|
| 107 |
-
/
|
| 108 |
-
|
|
|
|
|
|
|
| 109 |
|
| 110 |
-
# ── Frontend (pre-built in Stage 1) ───────────────────────────────────────────
|
| 111 |
COPY --from=frontend-builder --chown=user:user /build/dist /app/frontend/dist
|
| 112 |
|
| 113 |
-
# ── Backend ───────────────────────────────────────────────────────────────────
|
| 114 |
COPY --chown=user:user backend/package*.json /app/backend/
|
| 115 |
-
|
| 116 |
-
|
| 117 |
-
# (Node 20). The correct flag is --omit=dev.
|
| 118 |
-
# We run npm install as root so node-gyp can write to system temp dirs during native
|
| 119 |
-
# addon compilation (better-sqlite3), then hand ownership to the user.
|
| 120 |
-
RUN cd /app/backend && npm install --omit=dev && chown -R user:user /app/backend/node_modules
|
| 121 |
-
|
| 122 |
COPY --chown=user:user backend/src/ /app/backend/src/
|
| 123 |
|
| 124 |
-
# ── Configs ───────────────────────────────────────────────────────────────────
|
| 125 |
COPY --chown=user:user litellm/config.yaml /app/litellm/config.yaml
|
| 126 |
COPY --chown=user:user huggingface/nginx.conf /app/huggingface/nginx.conf
|
| 127 |
COPY --chown=user:user huggingface/supervisord.conf /app/huggingface/supervisord.conf
|
| 128 |
COPY --chown=user:user huggingface/entrypoint.sh /app/huggingface/entrypoint.sh
|
| 129 |
RUN chmod +x /app/huggingface/entrypoint.sh
|
| 130 |
|
| 131 |
-
# ── Switch to non-root ────────────────────────────────────────────────────────
|
| 132 |
USER user
|
| 133 |
WORKDIR /app
|
| 134 |
-
|
| 135 |
-
# HF Spaces listens on 7860 (declared in huggingface/README.md frontmatter)
|
| 136 |
EXPOSE 7860
|
| 137 |
-
|
| 138 |
-
ENTRYPOINT ["/app/huggingface/entrypoint.sh"]
|
|
|
|
| 1 |
+
# Dockerfile.huggingface - HF Spaces single container
|
| 2 |
+
# LiteLLM v1.81.14 with external PostgreSQL via DATABASE_URL
|
| 3 |
#
|
| 4 |
+
# Required HF Space secrets:
|
| 5 |
+
# DATABASE_URL postgresql://user:pass@host:5432/db
|
| 6 |
+
# LITELLM_SALT_KEY random string, encrypts API keys in DB (never change after first use)
|
| 7 |
+
# LITELLM_MASTER_KEY admin key
|
| 8 |
+
# JWT_SECRET session secret
|
| 9 |
#
|
| 10 |
+
# Bug fixes:
|
| 11 |
+
# [Bug2] build-essential for better-sqlite3 node-gyp fallback
|
| 12 |
+
# [Bug3] npm install --omit=dev (--only=production deprecated in npm v10)
|
| 13 |
+
# [Bug5] ARG LITELLM_VERSION for single-source versioning
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
|
|
|
|
| 15 |
FROM node:20-alpine AS frontend-builder
|
|
|
|
| 16 |
WORKDIR /build
|
|
|
|
|
|
|
| 17 |
ARG VITE_API_BASE=/api
|
| 18 |
ARG VITE_APP_NAME="AI Gateway Hub"
|
| 19 |
+
ENV VITE_API_BASE=$VITE_API_BASE VITE_APP_NAME=$VITE_APP_NAME
|
|
|
|
|
|
|
|
|
|
| 20 |
COPY frontend/package*.json ./
|
| 21 |
RUN npm install
|
|
|
|
| 22 |
COPY frontend/ .
|
| 23 |
RUN npm run build
|
| 24 |
|
|
|
|
| 25 |
FROM python:3.11-slim
|
| 26 |
|
| 27 |
+
ARG LITELLM_VERSION=1.81.14
|
|
|
|
|
|
|
|
|
|
|
|
|
| 28 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 29 |
RUN apt-get update && apt-get install -y --no-install-recommends \
|
| 30 |
+
curl gnupg ca-certificates nginx supervisor build-essential \
|
| 31 |
+
&& curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \
|
| 32 |
+
&& apt-get install -y --no-install-recommends nodejs \
|
| 33 |
+
&& apt-get purge -y gnupg && apt-get autoremove -y \
|
| 34 |
+
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 35 |
|
|
|
|
| 36 |
RUN pip install --no-cache-dir "litellm[proxy]==${LITELLM_VERSION}"
|
| 37 |
|
|
|
|
| 38 |
RUN useradd -m -u 1000 -s /bin/bash user
|
| 39 |
|
|
|
|
| 40 |
RUN mkdir -p \
|
| 41 |
+
/app/frontend/dist /app/backend/src /app/litellm \
|
| 42 |
+
/app/huggingface /app/data \
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 43 |
/var/log/supervisor \
|
| 44 |
+
/tmp/nginx/client_body /tmp/nginx/proxy \
|
| 45 |
+
/tmp/nginx/fastcgi /tmp/nginx/uwsgi /tmp/nginx/scgi \
|
| 46 |
+
&& chown -R user:user \
|
| 47 |
+
/app /var/log/supervisor \
|
| 48 |
+
/var/log/nginx /var/lib/nginx /tmp/nginx
|
| 49 |
|
|
|
|
| 50 |
COPY --from=frontend-builder --chown=user:user /build/dist /app/frontend/dist
|
| 51 |
|
|
|
|
| 52 |
COPY --chown=user:user backend/package*.json /app/backend/
|
| 53 |
+
RUN cd /app/backend && npm install --omit=dev \
|
| 54 |
+
&& chown -R user:user /app/backend/node_modules
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 55 |
COPY --chown=user:user backend/src/ /app/backend/src/
|
| 56 |
|
|
|
|
| 57 |
COPY --chown=user:user litellm/config.yaml /app/litellm/config.yaml
|
| 58 |
COPY --chown=user:user huggingface/nginx.conf /app/huggingface/nginx.conf
|
| 59 |
COPY --chown=user:user huggingface/supervisord.conf /app/huggingface/supervisord.conf
|
| 60 |
COPY --chown=user:user huggingface/entrypoint.sh /app/huggingface/entrypoint.sh
|
| 61 |
RUN chmod +x /app/huggingface/entrypoint.sh
|
| 62 |
|
|
|
|
| 63 |
USER user
|
| 64 |
WORKDIR /app
|
|
|
|
|
|
|
| 65 |
EXPOSE 7860
|
| 66 |
+
ENTRYPOINT ["/app/huggingface/entrypoint.sh"]
|
|
|
Dockerfile.huggingface
CHANGED
|
@@ -1,138 +1,66 @@
|
|
| 1 |
-
#
|
| 2 |
-
#
|
| 3 |
#
|
| 4 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
#
|
| 6 |
-
#
|
| 7 |
-
#
|
| 8 |
-
#
|
| 9 |
-
#
|
| 10 |
-
# │ / → static frontend files │
|
| 11 |
-
# │ /api/* → localhost:3001 (backend) │
|
| 12 |
-
# │ /v1/* → localhost:4000 (litellm) │
|
| 13 |
-
# └──────────────────────────────────────────┘
|
| 14 |
-
# │ │
|
| 15 |
-
# ▼ ▼
|
| 16 |
-
# Node.js backend LiteLLM proxy
|
| 17 |
-
# (port 3001) (port 4000)
|
| 18 |
-
# │
|
| 19 |
-
# ▼
|
| 20 |
-
# SQLite /app/data/gateway.db
|
| 21 |
-
#
|
| 22 |
-
# All processes are managed by supervisord.
|
| 23 |
-
#
|
| 24 |
-
# Bug fixes applied:
|
| 25 |
-
# [Bug2] Added build-essential so better-sqlite3 can compile via node-gyp
|
| 26 |
-
# if the prebuilt binary download fails.
|
| 27 |
-
# [Bug3] Changed `npm ci --only=production` → `npm install --omit=dev`
|
| 28 |
-
# (--only=production is deprecated since npm v7; Node 20 ships npm v10).
|
| 29 |
-
# [Bug5] LiteLLM pip version extracted to ARG LITELLM_VERSION so it stays
|
| 30 |
-
# in sync with docker-compose.yml without touching two separate lines.
|
| 31 |
-
# ─────────────────────────────────────────────────────────────────────────────
|
| 32 |
|
| 33 |
-
# ── Stage 1: Build React frontend ─────────────────────────────────────────────
|
| 34 |
FROM node:20-alpine AS frontend-builder
|
| 35 |
-
|
| 36 |
WORKDIR /build
|
| 37 |
-
|
| 38 |
-
# Build args match the original frontend/Dockerfile
|
| 39 |
ARG VITE_API_BASE=/api
|
| 40 |
ARG VITE_APP_NAME="AI Gateway Hub"
|
| 41 |
-
ENV VITE_API_BASE=$VITE_API_BASE
|
| 42 |
-
VITE_APP_NAME=$VITE_APP_NAME
|
| 43 |
-
|
| 44 |
-
# Layer-cache package install separately from source copy
|
| 45 |
COPY frontend/package*.json ./
|
| 46 |
RUN npm install
|
| 47 |
-
|
| 48 |
COPY frontend/ .
|
| 49 |
RUN npm run build
|
| 50 |
|
| 51 |
-
# ── Stage 2: Production runtime ───────────────────────────────────────────────
|
| 52 |
FROM python:3.11-slim
|
| 53 |
|
| 54 |
-
|
| 55 |
-
# docker-compose.yml: ghcr.io/berriai/litellm:main-v1.81.14-stable
|
| 56 |
-
# → PyPI package: litellm==1.81.14
|
| 57 |
-
# To upgrade: change both this ARG and the docker-compose image tag together.
|
| 58 |
-
ARG LITELLM_VERSION=1.50.4
|
| 59 |
|
| 60 |
-
# ── System deps ───────────────────────────────────────────────────────────────
|
| 61 |
-
# build-essential (make + g++) is required as a fallback compilation path for
|
| 62 |
-
# better-sqlite3. prebuild-install downloads a prebuilt .node binary at npm ci
|
| 63 |
-
# time; if that download fails (version mismatch, network timeout, etc.) the
|
| 64 |
-
# package falls back to compiling from source via node-gyp, which needs make
|
| 65 |
-
# and g++. Without build-essential that fallback path crashes the build.
|
| 66 |
RUN apt-get update && apt-get install -y --no-install-recommends \
|
| 67 |
-
curl \
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
build-essential \
|
| 73 |
-
&& \
|
| 74 |
-
# Node.js 20 LTS (backend runtime — frontend is pre-built in Stage 1)
|
| 75 |
-
curl -fsSL https://deb.nodesource.com/setup_20.x | bash - && \
|
| 76 |
-
apt-get install -y --no-install-recommends nodejs && \
|
| 77 |
-
# Clean up (gnupg no longer needed after nodesource setup)
|
| 78 |
-
apt-get purge -y gnupg && \
|
| 79 |
-
apt-get autoremove -y && \
|
| 80 |
-
rm -rf /var/lib/apt/lists/*
|
| 81 |
|
| 82 |
-
# ── LiteLLM proxy ─────────────────────────────────────────────────────────────
|
| 83 |
RUN pip install --no-cache-dir "litellm[proxy]==${LITELLM_VERSION}"
|
| 84 |
|
| 85 |
-
# ── Non-root user (HF Spaces recommendation: uid=1000) ────────────────────────
|
| 86 |
RUN useradd -m -u 1000 -s /bin/bash user
|
| 87 |
|
| 88 |
-
# ── Directory layout ──────────────────────────────────────────────────────────
|
| 89 |
RUN mkdir -p \
|
| 90 |
-
/app/frontend/dist \
|
| 91 |
-
/app/
|
| 92 |
-
/app/litellm \
|
| 93 |
-
/app/huggingface \
|
| 94 |
-
/app/data \
|
| 95 |
-
/var/log/supervisor \
|
| 96 |
-
/tmp/nginx/client_body \
|
| 97 |
-
/tmp/nginx/proxy \
|
| 98 |
-
/tmp/nginx/fastcgi \
|
| 99 |
-
/tmp/nginx/uwsgi \
|
| 100 |
-
/tmp/nginx/scgi \
|
| 101 |
-
&& \
|
| 102 |
-
# Give nginx writable log/lib dirs when running as uid 1000
|
| 103 |
-
chown -R user:user \
|
| 104 |
-
/app \
|
| 105 |
/var/log/supervisor \
|
| 106 |
-
/
|
| 107 |
-
/
|
| 108 |
-
|
|
|
|
|
|
|
| 109 |
|
| 110 |
-
# ── Frontend (pre-built in Stage 1) ───────────────────────────────────────────
|
| 111 |
COPY --from=frontend-builder --chown=user:user /build/dist /app/frontend/dist
|
| 112 |
|
| 113 |
-
# ── Backend ───────────────────────────────────────────────────────────────────
|
| 114 |
COPY --chown=user:user backend/package*.json /app/backend/
|
| 115 |
-
|
| 116 |
-
|
| 117 |
-
# (Node 20). The correct flag is --omit=dev.
|
| 118 |
-
# We run npm install as root so node-gyp can write to system temp dirs during native
|
| 119 |
-
# addon compilation (better-sqlite3), then hand ownership to the user.
|
| 120 |
-
RUN cd /app/backend && npm install --omit=dev && chown -R user:user /app/backend/node_modules
|
| 121 |
-
|
| 122 |
COPY --chown=user:user backend/src/ /app/backend/src/
|
| 123 |
|
| 124 |
-
# ── Configs ───────────────────────────────────────────────────────────────────
|
| 125 |
COPY --chown=user:user litellm/config.yaml /app/litellm/config.yaml
|
| 126 |
COPY --chown=user:user huggingface/nginx.conf /app/huggingface/nginx.conf
|
| 127 |
COPY --chown=user:user huggingface/supervisord.conf /app/huggingface/supervisord.conf
|
| 128 |
COPY --chown=user:user huggingface/entrypoint.sh /app/huggingface/entrypoint.sh
|
| 129 |
RUN chmod +x /app/huggingface/entrypoint.sh
|
| 130 |
|
| 131 |
-
# ── Switch to non-root ────────────────────────────────────────────────────────
|
| 132 |
USER user
|
| 133 |
WORKDIR /app
|
| 134 |
-
|
| 135 |
-
# HF Spaces listens on 7860 (declared in huggingface/README.md frontmatter)
|
| 136 |
EXPOSE 7860
|
| 137 |
-
|
| 138 |
-
ENTRYPOINT ["/app/huggingface/entrypoint.sh"]
|
|
|
|
| 1 |
+
# Dockerfile.huggingface - HF Spaces single container
|
| 2 |
+
# LiteLLM v1.81.14 with external PostgreSQL via DATABASE_URL
|
| 3 |
#
|
| 4 |
+
# Required HF Space secrets:
|
| 5 |
+
# DATABASE_URL postgresql://user:pass@host:5432/db
|
| 6 |
+
# LITELLM_SALT_KEY random string, encrypts API keys in DB (never change after first use)
|
| 7 |
+
# LITELLM_MASTER_KEY admin key
|
| 8 |
+
# JWT_SECRET session secret
|
| 9 |
#
|
| 10 |
+
# Bug fixes:
|
| 11 |
+
# [Bug2] build-essential for better-sqlite3 node-gyp fallback
|
| 12 |
+
# [Bug3] npm install --omit=dev (--only=production deprecated in npm v10)
|
| 13 |
+
# [Bug5] ARG LITELLM_VERSION for single-source versioning
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
|
|
|
|
| 15 |
FROM node:20-alpine AS frontend-builder
|
|
|
|
| 16 |
WORKDIR /build
|
|
|
|
|
|
|
| 17 |
ARG VITE_API_BASE=/api
|
| 18 |
ARG VITE_APP_NAME="AI Gateway Hub"
|
| 19 |
+
ENV VITE_API_BASE=$VITE_API_BASE VITE_APP_NAME=$VITE_APP_NAME
|
|
|
|
|
|
|
|
|
|
| 20 |
COPY frontend/package*.json ./
|
| 21 |
RUN npm install
|
|
|
|
| 22 |
COPY frontend/ .
|
| 23 |
RUN npm run build
|
| 24 |
|
|
|
|
| 25 |
FROM python:3.11-slim
|
| 26 |
|
| 27 |
+
ARG LITELLM_VERSION=1.81.14
|
|
|
|
|
|
|
|
|
|
|
|
|
| 28 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 29 |
RUN apt-get update && apt-get install -y --no-install-recommends \
|
| 30 |
+
curl gnupg ca-certificates nginx supervisor build-essential \
|
| 31 |
+
&& curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \
|
| 32 |
+
&& apt-get install -y --no-install-recommends nodejs \
|
| 33 |
+
&& apt-get purge -y gnupg && apt-get autoremove -y \
|
| 34 |
+
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 35 |
|
|
|
|
| 36 |
RUN pip install --no-cache-dir "litellm[proxy]==${LITELLM_VERSION}"
|
| 37 |
|
|
|
|
| 38 |
RUN useradd -m -u 1000 -s /bin/bash user
|
| 39 |
|
|
|
|
| 40 |
RUN mkdir -p \
|
| 41 |
+
/app/frontend/dist /app/backend/src /app/litellm \
|
| 42 |
+
/app/huggingface /app/data \
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 43 |
/var/log/supervisor \
|
| 44 |
+
/tmp/nginx/client_body /tmp/nginx/proxy \
|
| 45 |
+
/tmp/nginx/fastcgi /tmp/nginx/uwsgi /tmp/nginx/scgi \
|
| 46 |
+
&& chown -R user:user \
|
| 47 |
+
/app /var/log/supervisor \
|
| 48 |
+
/var/log/nginx /var/lib/nginx /tmp/nginx
|
| 49 |
|
|
|
|
| 50 |
COPY --from=frontend-builder --chown=user:user /build/dist /app/frontend/dist
|
| 51 |
|
|
|
|
| 52 |
COPY --chown=user:user backend/package*.json /app/backend/
|
| 53 |
+
RUN cd /app/backend && npm install --omit=dev \
|
| 54 |
+
&& chown -R user:user /app/backend/node_modules
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 55 |
COPY --chown=user:user backend/src/ /app/backend/src/
|
| 56 |
|
|
|
|
| 57 |
COPY --chown=user:user litellm/config.yaml /app/litellm/config.yaml
|
| 58 |
COPY --chown=user:user huggingface/nginx.conf /app/huggingface/nginx.conf
|
| 59 |
COPY --chown=user:user huggingface/supervisord.conf /app/huggingface/supervisord.conf
|
| 60 |
COPY --chown=user:user huggingface/entrypoint.sh /app/huggingface/entrypoint.sh
|
| 61 |
RUN chmod +x /app/huggingface/entrypoint.sh
|
| 62 |
|
|
|
|
| 63 |
USER user
|
| 64 |
WORKDIR /app
|
|
|
|
|
|
|
| 65 |
EXPOSE 7860
|
| 66 |
+
ENTRYPOINT ["/app/huggingface/entrypoint.sh"]
|
|
|