christinecha-choreographer-js
SUCCESS
22m 38s
History Source
SummaryIterations2Transcript36Dockerfile
Dockerfile30 lines · 805 chars
# Stage 1: build the library from source
FROM node:22.22.3-alpine3.23 as builder

WORKDIR /build

# Install dependencies (production + dev) to build the project
COPY package.json package.json
RUN npm install

# Install babel-cli to provide the Babel CLI for compiling the source
RUN npm install babel-cli --save-dev

# Copy the rest of the source and build/transpile to dist
COPY . .
RUN ./node_modules/.bin/babel src --out-dir dist

# Stage 2: lightweight runtime image containing the built library
FROM node:22.22.3-alpine3.23

WORKDIR /app

# Copy built artifacts from the builder stage
COPY --from=builder /build/dist /app/dist

# Copy smoke test script
COPY --from=builder /build/verify.js /app/verify.js

# Run a smoke test on container startup to verify the library loads
CMD ["node", "verify.js"]