# ---- build stage: produce the static Vite bundle ---- FROM node:22-alpine AS build RUN corepack enable WORKDIR /repo # Workspace manifests first, so `yarn install` layers cache across source changes COPY package.json yarn.lock .yarnrc.yml ./ COPY packages/shared/package.json ./packages/shared/package.json COPY apps/admin/package.json ./apps/admin/package.json RUN yarn workspaces focus @solelog/admin # Sources (@solelog/shared is consumed as raw TS, so it just needs to be present) COPY packages/shared/ ./packages/shared/ COPY apps/admin/ ./apps/admin/ # The API base URL is baked into the bundle at build time (Vite inlines import.meta.env.*). # Defaults to localhost for local builds; the Gitea workflow overrides it for production. ARG VITE_API_URL=http://localhost:3000 ENV VITE_API_URL=$VITE_API_URL # `vite build` only (no `tsc -b`): the image ships the bundle; type/test checks # are a separate CI concern and shouldn't gate the production image. RUN yarn workspace @solelog/admin exec vite build # ---- runtime stage: serve the static files with nginx ---- FROM nginx:alpine AS runtime COPY apps/admin/nginx.conf /etc/nginx/conf.d/default.conf COPY --from=build /repo/apps/admin/dist /usr/share/nginx/html EXPOSE 80