-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathContainerfile
More file actions
50 lines (37 loc) · 1.2 KB
/
Containerfile
File metadata and controls
50 lines (37 loc) · 1.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# Build stage
FROM node:20-alpine AS builder
# Install git for version generation
RUN apk add --no-cache git
# Set working directory
WORKDIR /app
# Copy package files and scripts (needed for postinstall)
COPY package*.json ./
COPY scripts/ ./scripts/
# Configure npm for better reliability in container builds
RUN npm config set fetch-timeout 600000 && \
npm config set fetch-retries 10 && \
npm config set fetch-retry-mintimeout 20000 && \
npm config set fetch-retry-maxtimeout 120000 && \
npm config set progress true && \
npm config set loglevel verbose
# Install dependencies with progress indicators
RUN echo "Starting npm ci at $(date)..." && \
npm ci --loglevel=info --progress=true && \
echo "npm ci completed at $(date)"
# Copy application source and environment files
COPY . .
COPY .env.production .env
# Build the application
RUN npm run build
# Production stage
FROM node:20-alpine
WORKDIR /app
# Install serve to serve static files
RUN npm install -g serve
# Copy built files from builder stage
COPY --from=builder /app/dist ./dist
COPY --from=builder /app/package.json ./
# Expose port 5174
EXPOSE 5174
# Start the application
CMD ["serve", "-s", "dist", "-l", "5174"]