# Use official Node.js LTS on Debian Bookworm
FROM node:lts-bookworm
# Create app directory
WORKDIR /usr/src/app
# Install system dependencies needed for building native modules
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential ca-certificates \
&& rm -rf /var/lib/apt/lists/*
# Install app dependencies (including grunt)
COPY package.json package.json
RUN npm install
# Copy the rest of the source code
COPY . .
# Build the project from source using explicit grunt tasks to avoid watch mode
RUN ./node_modules/.bin/grunt copy:demo uglify:html5shiv
# Optionally clean npm cache
RUN npm cache clean --force || true
# Install a lightweight static server to serve the built artifacts
RUN npm install -g http-server
EXPOSE 8080
# Serve the built dist directory
CMD ["http-server", "dist", "-p", "8080"]