27 lines
986 B
Docker
27 lines
986 B
Docker
# syntax=docker/dockerfile:1
|
|
|
|
# Single stage: the Vite/SolidJS app is built at *container start* rather than at
|
|
# image build, so VITE_* env vars passed to `docker run` are inlined into the bundle.
|
|
FROM node:24-alpine
|
|
WORKDIR /app
|
|
|
|
# pnpm ships with Node via corepack; pin to the version that produced pnpm-lock.yaml.
|
|
RUN corepack enable && corepack prepare pnpm@10.33.0 --activate
|
|
|
|
# `serve` (what `npx serve` runs) — installed now so the image is self-contained.
|
|
RUN npm install -g serve@14
|
|
|
|
# Install deps first so this layer is cached unless the manifest/lockfile change.
|
|
# devDependencies are kept because the build runs at container start.
|
|
COPY package.json pnpm-lock.yaml ./
|
|
RUN pnpm install --frozen-lockfile
|
|
|
|
# App source. The build itself is deferred to the CMD below.
|
|
COPY . .
|
|
|
|
EXPOSE 3000
|
|
|
|
# Build (`tsc && vite build` → /app/dist) at runtime so VITE_* vars from the
|
|
# environment configure the app, then serve the static output.
|
|
CMD pnpm build && serve -s dist -l 3000
|