Dockerfile31 lines · 692 chars # Use Node.js base image
FROM node:18-slim
# Set working directory
WORKDIR /usr/src/app
# Install system dependencies
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
build-essential \
python3 \
git \
ca-certificates \
&& rm -rf /var/lib/apt/lists/*
# Copy package manifests
COPY package.json package-lock.json ./
# Install dependencies
RUN npm ci --silent
# Copy source code
COPY . .
# Build the project
RUN npm run build
# Expose build artifacts directory (optional)
# Expose nothing. We just set a CMD to keep container alive
CMD ["bash","-lc","if [ -d build ]; then echo BUILD_DIR_FOUND; else echo BUILD_DIR_MISSING; fi; tail -f /dev/null"]