Files
router-lists-ui/Dockerfile.fast
T
denozord 3e8d43f1bd
Publish Fast Tabler Docker image / build-and-push-fast (push) Failing after 7m21s
fix CI
2025-07-09 08:56:03 +07:00

50 lines
1.3 KiB
Docker

# Stage 1: Build React frontend
FROM node:20-alpine AS frontend-builder
WORKDIR /app/frontend
# Install build dependencies for native modules
RUN apk add --no-cache python3 make g++
# Set npm config for better performance
RUN npm config set registry https://registry.npmjs.org/
RUN npm config set fetch-timeout 300000
RUN npm config set fetch-retry-mintimeout 20000
RUN npm config set fetch-retry-maxtimeout 120000
# Copy package files first for better caching
COPY frontend/package*.json ./
# Install dependencies with specific flags for speed and force rebuild
RUN npm ci --no-audit --no-fund --prefer-offline --build-from-source
# Copy source code
COPY frontend/ .
# Build the application
RUN npm run build
# Stage 2: Setup Node.js backend and serve everything
FROM node:20-alpine
WORKDIR /app
# Set npm config for better performance
RUN npm config set registry https://registry.npmjs.org/
RUN npm config set fetch-timeout 300000
# Copy package files first for better caching
COPY backend/package*.json ./
# Install production dependencies only
RUN npm ci --only=production --no-audit --no-fund --prefer-offline
# Copy backend source code
COPY backend/ .
# Copy built frontend assets from the previous stage
COPY --from=frontend-builder /app/frontend/dist ./public
# The port the backend runs on
EXPOSE 3001
# Start the server
CMD ["node", "server.js"]