styled-components-styled-components
SUCCESS
24m 05s
History Source
SummaryIterations2Transcript21Dockerfile
Dockerfile45 lines · 1297 chars
# syntax=docker/dockerfile:1

FROM node:18-slim AS builder

# Install system dependencies (git for any VCS deps, build tools for native addons)
RUN apt-get update \
  && apt-get install -y --no-install-recommends \
    git \
    build-essential \
    python3 \
  && rm -rf /var/lib/apt/lists/*

# Install pnpm (v10 per repo's lockfile / blueprint)
RUN npm i -g pnpm@10.0.0

WORKDIR /workspace

# Copy source code
COPY . .

# Install dependencies (respect lockfile) and build the styled-components package
RUN pnpm install --frozen-lockfile
RUN pnpm --filter styled-components build
RUN pnpm --filter styled-components postbuild


FROM node:18-slim AS runtime

# Create a non-root user for runtime
RUN groupadd -r app && useradd -m -r -u 1001 -g app app

WORKDIR /workspace

# Copy the built package from the builder stage
COPY --from=builder /workspace/packages/styled-components /workspace/packages/styled-components

# Ensure correct ownership for non-root user
RUN chown -R app:app /workspace/packages/styled-components

USER app

# Simple entrypoint to verify container works and where artifacts live
# Avoid complex quoting issues in CMD by using a simple echo command
CMD ["bash", "-lc", "echo 'styled-components build is ready. artifacts located at /workspace/packages/styled-components'"]