29 lines
733 B
Docker
29 lines
733 B
Docker
|
|
# syntax=docker/dockerfile:1
|
||
|
|
|
||
|
|
# ---------- build ----------
|
||
|
|
FROM node:22-alpine AS build
|
||
|
|
WORKDIR /app
|
||
|
|
|
||
|
|
# Deps first, so this layer is cached and only re-runs when the lockfile changes.
|
||
|
|
COPY package.json package-lock.json ./
|
||
|
|
RUN npm ci
|
||
|
|
|
||
|
|
COPY . .
|
||
|
|
RUN npm run build
|
||
|
|
|
||
|
|
# ---------- serve ----------
|
||
|
|
FROM nginx:alpine AS runtime
|
||
|
|
|
||
|
|
# Replace the packaged default site with ours.
|
||
|
|
RUN rm -f /etc/nginx/conf.d/default.conf
|
||
|
|
COPY nginx.conf /etc/nginx/conf.d/default.conf
|
||
|
|
COPY --from=build /app/dist /usr/share/nginx/html
|
||
|
|
|
||
|
|
# Coolify/Traefik route to this port.
|
||
|
|
EXPOSE 80
|
||
|
|
|
||
|
|
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
|
||
|
|
CMD wget --quiet --tries=1 --spider http://127.0.0.1/ || exit 1
|
||
|
|
|
||
|
|
CMD ["nginx", "-g", "daemon off;"]
|