mirror of
https://github.com/harivansh-afk/sandbox-agent.git
synced 2026-04-15 06:04:43 +00:00
Add Railway Caddy frontend images
This commit is contained in:
parent
940e49fcfa
commit
e79a3d9389
6 changed files with 107 additions and 4 deletions
16
foundry/docker/frontend-caddy-entrypoint.sh
Normal file
16
foundry/docker/frontend-caddy-entrypoint.sh
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
#!/bin/sh
|
||||
set -eu
|
||||
|
||||
escape_js() {
|
||||
printf '%s' "${1:-}" | sed 's/\\/\\\\/g; s/"/\\"/g'
|
||||
}
|
||||
|
||||
cat > /srv/__foundry_runtime_config.js <<EOF
|
||||
window.__FOUNDRY_RUNTIME_CONFIG__ = {
|
||||
backendEndpoint: "$(escape_js "${VITE_HF_BACKEND_ENDPOINT:-}")",
|
||||
defaultWorkspaceId: "$(escape_js "${VITE_HF_WORKSPACE:-}")",
|
||||
frontendClientMode: "$(escape_js "${FOUNDRY_FRONTEND_CLIENT_MODE:-remote}")"
|
||||
};
|
||||
EOF
|
||||
|
||||
exec caddy run --config /etc/caddy/Caddyfile --adapter caddyfile
|
||||
11
foundry/docker/frontend.Caddyfile
Normal file
11
foundry/docker/frontend.Caddyfile
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
{
|
||||
auto_https off
|
||||
}
|
||||
|
||||
:{$PORT:80} {
|
||||
root * /srv
|
||||
encode gzip zstd
|
||||
header /__foundry_runtime_config.js Cache-Control "no-store"
|
||||
try_files {path} /index.html
|
||||
file_server
|
||||
}
|
||||
30
foundry/docker/frontend.Dockerfile
Normal file
30
foundry/docker/frontend.Dockerfile
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
# syntax=docker/dockerfile:1.7
|
||||
|
||||
FROM node:22-bookworm-slim AS base
|
||||
ENV PNPM_HOME=/pnpm
|
||||
ENV PATH=$PNPM_HOME:$PATH
|
||||
WORKDIR /app
|
||||
RUN corepack enable && corepack prepare pnpm@9.15.0 --activate
|
||||
|
||||
FROM base AS build
|
||||
COPY . .
|
||||
RUN pnpm install --frozen-lockfile
|
||||
RUN pnpm --filter @sandbox-agent/foundry-shared build
|
||||
RUN pnpm --filter acp-http-client build
|
||||
RUN pnpm --filter @sandbox-agent/cli-shared build
|
||||
RUN SKIP_OPENAPI_GEN=1 pnpm --filter sandbox-agent build
|
||||
RUN pnpm --filter @sandbox-agent/react build
|
||||
RUN pnpm --filter @sandbox-agent/foundry-client build
|
||||
RUN pnpm --filter @sandbox-agent/foundry-frontend-errors build
|
||||
ENV FOUNDRY_FRONTEND_CLIENT_MODE=remote
|
||||
RUN pnpm --filter @sandbox-agent/foundry-frontend build
|
||||
|
||||
FROM caddy:2.10-alpine AS runtime
|
||||
COPY foundry/docker/frontend.Caddyfile /etc/caddy/Caddyfile
|
||||
COPY foundry/docker/frontend-caddy-entrypoint.sh /usr/local/bin/foundry-frontend-entrypoint
|
||||
COPY --from=build /app/foundry/packages/frontend/dist /srv
|
||||
RUN chmod +x /usr/local/bin/foundry-frontend-entrypoint
|
||||
ENV PORT=80
|
||||
ENV FOUNDRY_FRONTEND_CLIENT_MODE=remote
|
||||
EXPOSE 80
|
||||
ENTRYPOINT ["/usr/local/bin/foundry-frontend-entrypoint"]
|
||||
30
foundry/docker/frontend.mock.Dockerfile
Normal file
30
foundry/docker/frontend.mock.Dockerfile
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
# syntax=docker/dockerfile:1.7
|
||||
|
||||
FROM node:22-bookworm-slim AS base
|
||||
ENV PNPM_HOME=/pnpm
|
||||
ENV PATH=$PNPM_HOME:$PATH
|
||||
WORKDIR /app
|
||||
RUN corepack enable && corepack prepare pnpm@9.15.0 --activate
|
||||
|
||||
FROM base AS build
|
||||
COPY . .
|
||||
RUN pnpm install --frozen-lockfile
|
||||
RUN pnpm --filter @sandbox-agent/foundry-shared build
|
||||
RUN pnpm --filter acp-http-client build
|
||||
RUN pnpm --filter @sandbox-agent/cli-shared build
|
||||
RUN SKIP_OPENAPI_GEN=1 pnpm --filter sandbox-agent build
|
||||
RUN pnpm --filter @sandbox-agent/react build
|
||||
RUN pnpm --filter @sandbox-agent/foundry-client build
|
||||
RUN pnpm --filter @sandbox-agent/foundry-frontend-errors build
|
||||
ENV FOUNDRY_FRONTEND_CLIENT_MODE=mock
|
||||
RUN pnpm --filter @sandbox-agent/foundry-frontend build
|
||||
|
||||
FROM caddy:2.10-alpine AS runtime
|
||||
COPY foundry/docker/frontend.Caddyfile /etc/caddy/Caddyfile
|
||||
COPY foundry/docker/frontend-caddy-entrypoint.sh /usr/local/bin/foundry-frontend-entrypoint
|
||||
COPY --from=build /app/foundry/packages/frontend/dist /srv
|
||||
RUN chmod +x /usr/local/bin/foundry-frontend-entrypoint
|
||||
ENV PORT=80
|
||||
ENV FOUNDRY_FRONTEND_CLIENT_MODE=mock
|
||||
EXPOSE 80
|
||||
ENTRYPOINT ["/usr/local/bin/foundry-frontend-entrypoint"]
|
||||
Loading…
Add table
Add a link
Reference in a new issue