facebook-react
SUCCESS
78m 39s
History Source
SummaryIterations3Transcript59Dockerfile
Dockerfile49 lines · 1439 chars
FROM node:20-bullseye-slim AS builder

# Install system dependencies
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update \
  && apt-get install -y --no-install-recommends \
    ca-certificates \
    curl \
    git \
    python3 \
    make \
    g++ \
  && rm -rf /var/lib/apt/lists/*

WORKDIR /workspace

# Copy the full monorepo compiler directory to the build context
COPY compiler /workspace/compiler

WORKDIR /workspace/compiler

# Enable Corepack and pin Yarn to the version used by the project
RUN corepack enable \
  && corepack prepare yarn@1.22.22 --activate

# Install dependencies for the monorepo
RUN yarn install --frozen-lockfile

# Ensure playground dependencies are installed and build the playground as part of the monorepo
RUN yarn --cwd apps/playground install --frozen-lockfile
RUN yarn --cwd apps/playground build

FROM node:20-bullseye-slim AS runtime

ENV NODE_ENV=production
WORKDIR /workspace

# Copy built artifacts and dependencies from builder
COPY --from=builder /workspace/compiler /workspace/compiler

# Ensure we can run next binary from common yarn bin directories
ENV PATH=/workspace/compiler/node_modules/.bin:/workspace/compiler/apps/playground/node_modules/.bin:$PATH

# Expose the Next.js playground port
EXPOSE 3000

# Run the Next.js production server for the playground app
CMD ["bash", "-lc", "cd /workspace/compiler/apps/playground && NODE_ENV=production NEXT_TELEMETRY_DISABLED=1 next start"]