forked from open-webui/open-webui
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
64 lines (49 loc) · 1.55 KB
/
Dockerfile
File metadata and controls
64 lines (49 loc) · 1.55 KB
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# ---------- Frontend build ----------
FROM node:22-alpine3.20 AS build
# Augmente la mémoire Node
ENV NODE_OPTIONS="--max-old-space-size=4096"
WORKDIR /app
# Installer git pour versioning
RUN apk add --no-cache git
# Copier package.json et installer deps
COPY package.json package-lock.json ./
RUN npm ci --force
# Copier le reste et build
COPY . .
RUN npm run build
# ---------- Backend Python ----------
FROM python:3.11-slim-bookworm AS base
WORKDIR /app/backend
# Variables d'environnement
ENV ENV=prod \
PORT=8080 \
WEBUI_SECRET_KEY="" \
SCARF_NO_ANALYTICS=true \
DO_NOT_TRACK=true \
ANONYMIZED_TELEMETRY=false
# Installer dépendances système
RUN apt-get update && apt-get install -y --no-install-recommends \
git build-essential curl ffmpeg libsm6 libxext6 \
python3-dev \
&& rm -rf /var/lib/apt/lists/*
# Copier requirements et installer Python deps
COPY ./backend/requirements.txt ./requirements.txt
RUN pip install --no-cache-dir -r requirements.txt
# Copier le backend et le frontend build
COPY --from=build /app/build /app/build
COPY ./backend .
# Exposer le port attendu par Cloud Run
EXPOSE 8080
# Copier start.sh et donner les droits d’exécution
COPY start.sh /app/backend/start.sh
RUN chmod +x /app/backend/start.sh
# Utiliser un user non-root si besoin
ARG UID=0
ARG GID=0
RUN if [ $UID -ne 0 ]; then \
if [ $GID -ne 0 ]; then addgroup --gid $GID app; fi; \
adduser --uid $UID --gid $GID --disabled-password --no-create-home app; \
fi
USER $UID:$GID
# Commande finale
CMD ["/app/backend/start.sh"]