forked from promptfoo/promptfoo
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Standalone server with database (promptfoo#118)
Notable changes: Foundations for a shared database, so that a team can collaborate on evals Enable self-hosting, so that sharing is possible without relying on the www.promptfoo.dev host Users can run evals directly through the hosted web UI without running promptfoo locally (good for non-technical prompt writers) Lots of tangentially related cleanup along the way, including: Making providers consistently handle config, and adding support for config.apiKey across providers Improve the formatting and verbosity of errors in the table view Related to promptfoo#99
- Loading branch information
Showing
53 changed files
with
2,528 additions
and
5,581 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,32 @@ | ||
FROM node:16-alpine | ||
ENV PROMPTFOO_STANDALONE_SERVER=1 | ||
# https://github.com/vercel/next.js/blob/canary/examples/with-docker/Dockerfile | ||
|
||
WORKDIR /app | ||
# ---- Build ---- | ||
FROM node:16-alpine AS builder | ||
ENV NEXT_PUBLIC_PROMPTFOO_BUILD_STANDALONE_SERVER=1 | ||
|
||
WORKDIR /app | ||
COPY . . | ||
|
||
WORKDIR /app/src/web/nextui | ||
# Envars are read in from src/web/nextui/.env.production | ||
RUN echo "*** Building with env vars from .env.production" | ||
|
||
# TODO(ian): Modify to multistep build so we don't carry over development packages | ||
RUN npm install | ||
RUN npm run build | ||
|
||
WORKDIR /app/src/web/nextui | ||
RUN npm prune --production | ||
|
||
# ---- Final Stage ---- | ||
FROM node:16-alpine | ||
|
||
WORKDIR /app | ||
|
||
COPY --from=builder /app/src/web/nextui/public ./public | ||
COPY --from=builder /app/src/web/nextui/.next/standalone ./ | ||
COPY --from=builder /app/src/web/nextui/.next/static ./.next/static | ||
|
||
EXPOSE 3000 | ||
|
||
CMD ["npm", "start"] | ||
ENV PORT 3000 | ||
ENV HOSTNAME "0.0.0.0" | ||
|
||
CMD ["node", "server.js"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# fly.toml app configuration file generated for promptfoo-web on 2023-08-26T20:54:31-07:00 | ||
# | ||
# See https://fly.io/docs/reference/configuration/ for information about how to use this file. | ||
# | ||
|
||
app = "promptfoo-web" | ||
primary_region = "sjc" | ||
|
||
[env] | ||
NODE_ENV = "production" | ||
|
||
[build] | ||
|
||
[http_service] | ||
internal_port = 3000 | ||
force_https = true | ||
auto_stop_machines = true | ||
auto_start_machines = true | ||
min_machines_running = 0 | ||
processes = ["app"] |
Oops, something went wrong.