hustcc-echarts-for-react
SUCCESS
5m 35s
History Source
SummaryIterations1Transcript7Dockerfile
Dockerfile37 lines · 929 chars
# syntax=docker/dockerfile:1

# Stage 1: Build the project from source
FROM node:20-slim as builder

WORKDIR /app

# Install system build dependencies
RUN apt-get update \
  && apt-get install -y --no-install-recommends \
    python3 \
    build-essential \
  && rm -rf /var/lib/apt/lists/*

# Install dependencies
COPY package.json package.json
RUN npm install --legacy-peer-deps

# Copy all source files and build (bypass tests if possible by using lib directly)
COPY . .

# Build the library outputs (lib and esm) without running tests
RUN npm run lib

# Stage 2: Runtime image
FROM node:20-slim

WORKDIR /app

# Copy built artifacts from builder
COPY --from=builder /app/lib /app/lib
COPY --from=builder /app/esm /app/esm
COPY package.json package.json

# Simple startup check to confirm the image is usable
CMD ["/bin/sh","-lc","if [ -d /app/lib ] && [ -d /app/esm ]; then echo 'build dirs exist'; else echo 'missing'; fi"]