26 lines
809 B
Docker
26 lines
809 B
Docker
# syntax=docker/dockerfile:1
|
|
|
|
# ---- deps: install node_modules once, shared by the dev and build stages ----
|
|
FROM node:22-alpine AS deps
|
|
WORKDIR /app
|
|
COPY package.json package-lock.json ./
|
|
RUN npm ci
|
|
|
|
# ---- dev: Vite dev server with hot reload (used by the `dev` compose profile) ----
|
|
FROM deps AS dev
|
|
COPY . .
|
|
EXPOSE 5173
|
|
CMD ["npm", "run", "dev", "--", "--host", "0.0.0.0", "--port", "5173"]
|
|
|
|
# ---- build: typecheck and produce the static site in /app/dist ----
|
|
FROM deps AS build
|
|
COPY . .
|
|
RUN npm run build
|
|
|
|
# ---- runtime: serve the static site with nginx ----
|
|
FROM nginx:1.29-alpine AS runtime
|
|
COPY docker/nginx.conf /etc/nginx/conf.d/default.conf
|
|
COPY --from=build /app/dist /usr/share/nginx/html
|
|
EXPOSE 80
|
|
HEALTHCHECK --interval=30s --timeout=3s CMD wget -qO- http://127.0.0.1/ >/dev/null || exit 1
|