# Spicy CDK Docker Image for Jenkins Runners
# This image contains everything needed to deploy CDK stacks from Jenkins pipelines

FROM node:24-alpine

# Update package index and upgrade all system packages to patch vulnerabilities
RUN apk update && apk upgrade

# Install AWS CLI and other dependencies
RUN apk add \
    python3 \
    py3-pip \
    git \
    bash \
    curl \
    jq \
    && pip3 install --break-system-packages awscli

# Install pnpm globally
RUN corepack enable && corepack prepare pnpm@latest --activate

# Install AWS CDK CLI globally
RUN npm install -g aws-cdk

# Set working directory
WORKDIR /app

# Copy package files first for better layer caching
COPY package.json pnpm-lock.yaml ./

# Install dependencies
RUN pnpm install --frozen-lockfile

# Copy the rest of the application
COPY . .

# Verify CDK is working
RUN cdk --version

# Default command shows help
CMD ["cdk", "--help"]

