# Multi-stage Dockerfile for startbootstrap-simple-sidebar
# Build stage: install dependencies and build the project
FROM node:22.22.3-alpine3.23 AS build
WORKDIR /app
# Install dependencies
COPY package.json package-lock.json ./
RUN npm install
# Copy all source files
COPY . .
# Build the project (generates dist directory)
RUN npm run build
# Runtime stage: serve the built dist directory with a lightweight static server
FROM node:22.22.3-alpine3.23 AS runtime
WORKDIR /app
# Copy built assets from the build stage
COPY --from=build /app/dist ./dist
# Install a minimal static server to serve the built site
RUN npm install -g http-server
# Expose the port used by the static server
EXPOSE 3000
# Start the static server serving the dist directory
CMD ["http-server", "dist", "-p", "3000"]