christinecha-choreographer-js
SUCCESS
18m 03s
History Source
SummaryIterations2Transcript21Dockerfile
Dockerfile37 lines · 940 chars
FROM node:22.22.3-alpine3.23 AS builder
WORKDIR /app

# Install dependencies
COPY package.json .
RUN npm install
# Install Babel CLI (Babel 6 era) for the babel CLI usage in build
RUN npm install babel-cli@6 --save-dev

# Copy sources
COPY src ./src
COPY webpack.config.js ./

# Build steps: Babel compile (single-run, not watch)
RUN ./node_modules/.bin/babel src --out-dir dist

# Bundle with webpack
RUN ./node_modules/.bin/webpack


FROM node:22.22.3-alpine3.23
WORKDIR /app

# Copy built artifacts and node_modules for runtime
COPY --from=builder /app/dist /app/dist
COPY --from=builder /app/node_modules /app/node_modules

# Install a lightweight static server to serve the dist bundle
RUN npm install -g http-server
# Install bash and make /bin/sh point to bash to better support complex shell commands in smoke tests
RUN apk add --no-cache bash \
  && ln -sf /bin/bash /bin/sh

EXPOSE 8080

CMD ["http-server", "dist", "-p", "8080"]