revert(server/docker): restore assets distribution image
This commit is contained in:
+4
-30
@@ -1,45 +1,19 @@
|
||||
# Stage 1: build ui-server-auth from source so the HTML's Vite `base` and
|
||||
# the server's route prefix are guaranteed to come from the SAME commit.
|
||||
# Pulling a prebuilt `ghcr.io/moeru-ai/airi/ui-server-auth:latest` image
|
||||
# previously let the two drift (server route changed to `/auth/`, prebuilt
|
||||
# HTML still at `/_ui/server-auth/` → every asset 404 in prod).
|
||||
#
|
||||
# Debian slim (glibc), not alpine: the workspace pulls in `canvas` via
|
||||
# jsdom→vitest. Canvas only ships prebuilt binaries for glibc, not musl;
|
||||
# on alpine `prebuild-install` falls through to `node-gyp rebuild` which
|
||||
# fails without `python3 make g++ cairo-dev pango-dev ...`. Slim is ~30MB
|
||||
# heavier than alpine but is throwaway — only stage 2 ships.
|
||||
FROM node:24-slim AS ui-build
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
RUN corepack enable
|
||||
|
||||
COPY . .
|
||||
|
||||
RUN pnpm install --frozen-lockfile
|
||||
|
||||
RUN pnpm -F @proj-airi/ui-server-auth run build
|
||||
|
||||
# Stage 2: server runtime. Vite emits the UI dist into
|
||||
# /app/apps/server/public/ui-server-auth via its `outDir`, so we COPY from
|
||||
# that exact path in the builder. Server install can stay --ignore-scripts
|
||||
# since the UI is already built and the server has no native deps that
|
||||
# need postinstall.
|
||||
FROM node:24-alpine
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
RUN corepack enable
|
||||
|
||||
|
||||
COPY pnpm-lock.yaml pnpm-workspace.yaml package.json tsconfig.json ./
|
||||
COPY patches/ ./patches/
|
||||
COPY apps/server apps/server
|
||||
COPY --from=ghcr.io/moeru-ai/airi/ui-server-auth:latest /app/airi/projects/ui/ui-server-auth apps/server/public/ui-server-auth
|
||||
COPY packages/server-schema packages/server-schema
|
||||
COPY packages/server-sdk-shared packages/server-sdk-shared
|
||||
COPY --from=ui-build /app/apps/server/public/ui-server-auth apps/server/public/ui-server-auth
|
||||
|
||||
RUN pnpm install --frozen-lockfile --ignore-scripts
|
||||
RUN --mount=type=cache,id=pnpm-store,target=/root/.pnpm-store \
|
||||
pnpm install --frozen-lockfile --ignore-scripts
|
||||
|
||||
RUN pnpm -F @proj-airi/server-schema run build
|
||||
RUN pnpm -F @proj-airi/server-sdk-shared run build
|
||||
|
||||
@@ -1,31 +1,3 @@
|
||||
# Stage 1: build ui-server-auth from source so the HTML's Vite `base` and
|
||||
# the server's route prefix are guaranteed to come from the SAME commit.
|
||||
# Pulling a prebuilt `ghcr.io/moeru-ai/airi/ui-server-auth:latest` image
|
||||
# previously let the two drift (server route changed to `/auth/`, prebuilt
|
||||
# HTML still at `/_ui/server-auth/` → every asset 404 in prod).
|
||||
#
|
||||
# Debian slim (glibc), not alpine: the workspace pulls in `canvas` via
|
||||
# jsdom→vitest. Canvas only ships prebuilt binaries for glibc, not musl;
|
||||
# on alpine `prebuild-install` falls through to `node-gyp rebuild` which
|
||||
# fails without `python3 make g++ cairo-dev pango-dev ...`. Slim is ~30MB
|
||||
# heavier than alpine but is throwaway — only stage 2 ships.
|
||||
FROM node:24-slim AS ui-build
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
RUN corepack enable
|
||||
|
||||
COPY . .
|
||||
|
||||
RUN pnpm install --frozen-lockfile
|
||||
|
||||
RUN pnpm -F @proj-airi/ui-server-auth run build
|
||||
|
||||
# Stage 2: server runtime. Vite emits the UI dist into
|
||||
# /app/apps/server/public/ui-server-auth via its `outDir`, so we COPY from
|
||||
# that exact path in the builder. Server install can stay --ignore-scripts
|
||||
# since the UI is already built and the server has no native deps that
|
||||
# need postinstall.
|
||||
FROM node:24-alpine
|
||||
|
||||
WORKDIR /app
|
||||
@@ -34,10 +6,10 @@ RUN corepack enable
|
||||
|
||||
COPY pnpm-lock.yaml pnpm-workspace.yaml package.json tsconfig.json ./
|
||||
COPY patches/ ./patches/
|
||||
COPY --from=ghcr.io/moeru-ai/airi/ui-server-auth:latest /app/airi/projects/ui/ui-server-auth apps/server/public/ui-server-auth
|
||||
COPY apps/server apps/server
|
||||
COPY packages/server-schema packages/server-schema
|
||||
COPY packages/server-sdk-shared packages/server-sdk-shared
|
||||
COPY --from=ui-build /app/apps/server/public/ui-server-auth apps/server/public/ui-server-auth
|
||||
|
||||
RUN pnpm install --frozen-lockfile --ignore-scripts
|
||||
|
||||
|
||||
@@ -3,7 +3,6 @@ builder = "DOCKERFILE"
|
||||
dockerfilePath = "/apps/server/production/railway/Dockerfile"
|
||||
watchPatterns = [
|
||||
"apps/server/**",
|
||||
"apps/ui-server-auth/**",
|
||||
"packages/**",
|
||||
"pnpm-lock.yaml"
|
||||
]
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
FROM scratch
|
||||
|
||||
WORKDIR /app/airi/projects/ui/ui-server-auth
|
||||
COPY . /app/airi/projects/ui/ui-server-auth
|
||||
Reference in New Issue
Block a user