diff --git a/urapt-web/.dockerignore b/urapt-web/.dockerignore new file mode 100644 index 0000000..85d1cae --- /dev/null +++ b/urapt-web/.dockerignore @@ -0,0 +1,9 @@ +node_modules +dist +.git +.gitignore +Dockerfile +README.md +*.tsbuildinfo +.env +.env.* diff --git a/urapt-web/Caddyfile b/urapt-web/Caddyfile new file mode 100644 index 0000000..625e0ad --- /dev/null +++ b/urapt-web/Caddyfile @@ -0,0 +1,24 @@ +{ + auto_https off +} + +:{$PORT} { + root * /srv + + handle /api/* { + reverse_proxy {$URAPT_SERVER_URL} { + header_up Host {upstream_hostport} + } + } + + handle /apt/* { + reverse_proxy {$URAPT_SERVER_URL} { + header_up Host {upstream_hostport} + } + } + + handle { + try_files {path} /index.html + file_server + } +} diff --git a/urapt-web/Dockerfile b/urapt-web/Dockerfile new file mode 100644 index 0000000..b54f16f --- /dev/null +++ b/urapt-web/Dockerfile @@ -0,0 +1,14 @@ +FROM node:20-alpine AS build +WORKDIR /app + +RUN corepack enable + +COPY package.json pnpm-lock.yaml ./ +RUN pnpm install --frozen-lockfile + +COPY . . +RUN pnpm build + +FROM caddy:2-alpine +COPY --from=build /app/dist /srv +COPY Caddyfile /etc/caddy/Caddyfile diff --git a/urapt-web/README.md b/urapt-web/README.md index d9723d7..253207b 100644 --- a/urapt-web/README.md +++ b/urapt-web/README.md @@ -65,6 +65,21 @@ and `/apt` to `urapt-server`. No CORS, no server changes — the API base is jus pnpm build # outputs dist/ ``` +### Railway + +`urapt-web/` includes a Dockerfile for deploying the UI as a separate Railway +service. The container builds the Vite app and serves it with Caddy, proxying +`/api/*` and `/apt/*` to an existing `urapt-server` service. + +In Railway, create a new service from this repo with: + +- Root Directory: `urapt-web` +- Environment variable: `URAPT_SERVER_URL=https://your-urapt-server.up.railway.app` + +Do not set `VITE_API_BASE_URL` for this deployment; the UI should keep using the +default same-origin `/api/v1` path. + + ### Caddy ```caddy