anydrop/web/Dockerfile
ordinarthur 0b90d9cdb5
Some checks failed
Build & Deploy / build-and-deploy (push) Failing after 11s
fix(docker): materialize @anydrop/shared as real dir, not workspace symlink
pnpm's workspace symlink (server/node_modules/@anydrop/shared → ../../../shared)
works locally but breaks on the Gitea Actions runner. TSC resolves the symlink
but cannot read through it, yielding TS2307 on "@anydrop/shared".

Fix: after building shared, copy its package.json + dist into
{server,web}/node_modules/@anydrop/shared as a plain directory before running
the dependent build. Module resolution becomes filesystem-local, independent
of BuildKit layer semantics or storage driver symlink handling.
2026-04-20 10:05:47 +02:00

32 lines
875 B
Docker

# Build stage
FROM node:20-alpine AS build
WORKDIR /app
RUN corepack enable && corepack prepare pnpm@10.31.0 --activate
ARG VITE_WS_URL
COPY package.json pnpm-lock.yaml pnpm-workspace.yaml ./
COPY tsconfig.base.json ./
COPY shared/package.json shared/
COPY server/package.json server/
COPY web/package.json web/
RUN pnpm install --frozen-lockfile
COPY shared/ shared/
COPY web/ web/
RUN pnpm --filter @anydrop/shared run build \
&& test -f shared/dist/index.d.ts \
&& rm -rf web/node_modules/@anydrop/shared \
&& mkdir -p web/node_modules/@anydrop/shared \
&& cp -r shared/package.json shared/dist web/node_modules/@anydrop/shared/ \
&& pnpm --filter @anydrop/web exec vite build
# Runtime stage
FROM nginx:alpine
COPY web/nginx.conf /etc/nginx/conf.d/default.conf
COPY --from=build /app/web/dist /usr/share/nginx/html
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]