# Multi-stage Dockerfile to build Numeral.js from source and provide a lightweight consumer image
FROM node:18-bullseye AS builder
WORKDIR /build
# Install dependencies first to leverage Docker layer caching
COPY package.json ./
RUN npm install
# Copy the rest of the source code and build
COPY . ./
RUN ./node_modules/.bin/grunt dist
FROM node:18-slim
WORKDIR /usr/src/app
# Create dist directory and copy built artifacts from builder
RUN mkdir -p dist
COPY --from=builder /build/numeral.js ./dist/numeral.js
COPY --from=builder /build/locales.js ./dist/locales.js
# Expose a simple startup message (no server to run)
CMD ["node", "-e", "console.log('Numeral.js dist ready')"]