Files
router-lists-ui/Dockerfile
T
denozord 97711f26cb
Publish Tabler Docker image / build-and-push-tabler (push) Has been cancelled
Publish Fast Tabler Docker image / build-and-push-fast (push) Failing after 5m52s
chore: Optimize Dockerfile for improved build performance and update Gitea workflows with Docker Buildx support
2025-07-08 23:44:11 +07:00

47 lines
1.2 KiB
Docker

# Stage 1: Build React frontend
FROM node:20-slim AS frontend-builder
WORKDIR /app/frontend
# 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
RUN npm ci --only=production --no-audit --no-fund --prefer-offline
# Copy source code
COPY frontend/ .
# Build the application
RUN npm run build
# Stage 2: Setup Node.js backend and serve everything
FROM node:20-slim
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"]