react-native-config-react-native-config
SUCCESS
13m 45s
History Source
SummaryIterations1Transcript9Dockerfile
Dockerfile43 lines · 987 chars
# Build from source for react-native-config
# Stage 1: builder with Node tools
FROM node:18-slim AS builder

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

WORKDIR /workspace

# Copy package.json first to leverage Docker cache
COPY package.json ./

# Install dependencies with npm (avoid Yarn lockfile issues)
RUN npm install --legacy-peer-deps

# Copy the rest of the repository
COPY . .

# Attempt to build if a build script exists; don't fail the image if not
RUN if [ -f package.json ] ; then npm run build || true; fi


# Stage 2: runtime image
FROM node:18-slim

WORKDIR /app

# Create non-root user for better security (optional)
# RUN useradd -m appuser
# USER appuser

# Copy built sources from builder
COPY --from=builder /workspace /app

# Default to a shell to keep the container usable
CMD ["bash"]