Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel

Dockerfile 1.6 KB

You have to be logged in to leave a comment. Sign In
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
  1. FROM --platform=${BUILDPLATFORM} node:22.14.0-alpine
  2. FROM node:22.14.0-alpine AS base
  3. RUN addgroup -S promptfoo && adduser -S promptfoo -G promptfoo
  4. # Install dependencies only when needed
  5. FROM base AS builder
  6. # Check https://github.com/nodejs/docker-node/tree/b4117f9333da4138b03a546ec926ef50a31506c3#nodealpine to understand why libc6-compat might be needed.
  7. RUN apk add --no-cache libc6-compat
  8. WORKDIR /app
  9. ARG VITE_PUBLIC_BASENAME
  10. ARG PROMPTFOO_REMOTE_API_BASE_URL
  11. # Set environment variables for the build
  12. ENV VITE_IS_HOSTED=1 \
  13. VITE_TELEMETRY_DISABLED=1 \
  14. VITE_PUBLIC_BASENAME=${VITE_PUBLIC_BASENAME} \
  15. PROMPTFOO_REMOTE_API_BASE_URL=${PROMPTFOO_REMOTE_API_BASE_URL}
  16. COPY . .
  17. RUN npm install --install-links --include=peer
  18. # Run npm install for the react app
  19. WORKDIR /app/src/app
  20. RUN npm install
  21. WORKDIR /app
  22. RUN npm run build
  23. FROM base AS server
  24. WORKDIR /app
  25. COPY --from=builder /app/node_modules ./node_modules
  26. COPY --from=builder /app/dist ./dist
  27. # Make Python version configurable with a default of 3.12
  28. ARG PYTHON_VERSION=3.12
  29. # Install Python for python providers, prompts, asserts, etc.
  30. RUN apk add --no-cache python3~=${PYTHON_VERSION} py3-pip py3-setuptools curl && \
  31. ln -sf python3 /usr/bin/python && \
  32. npm link promptfoo
  33. ENV API_PORT=3000
  34. ENV HOST=0.0.0.0
  35. ENV PROMPTFOO_SELF_HOSTED=1
  36. RUN chown -R promptfoo:promptfoo /app
  37. USER promptfoo
  38. RUN mkdir -p /home/promptfoo/.promptfoo
  39. EXPOSE 3000
  40. # Set up healthcheck
  41. HEALTHCHECK --interval=30s --timeout=10s --start-period=5s CMD curl -f http://localhost:3000/health || exit 1
  42. CMD ["node", "dist/src/server/index.js"]
Tip!

Press p or to see the previous file or, n or to see the next file

Comments

Loading...