-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
77 lines (52 loc) · 1.46 KB
/
Dockerfile
File metadata and controls
77 lines (52 loc) · 1.46 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# Multi-stage Dockerfile for MakerFriends.com
# This Dockerfile supports both development and production builds
# Stage 1: Base image with Node.js
FROM node:22-alpine AS base
# Install dependencies needed for native modules
RUN apk add --no-cache libc6-compat
# Set working directory
WORKDIR /app
# Stage 2: Dependencies
FROM base AS deps
# Copy package files
COPY package.json package-lock.json* ./
# Install dependencies
RUN npm ci --only=production
# Stage 3: Development
FROM base AS dev
# Copy package files
COPY package.json package-lock.json* ./
# Install all dependencies (including dev dependencies)
RUN npm ci
# Copy source code
COPY . .
# Expose development port
EXPOSE 4321
# Start development server
CMD ["npm", "run", "dev", "--", "--host", "0.0.0.0"]
# Stage 4: Build
FROM base AS builder
# Copy package files
COPY package.json package-lock.json* ./
# Install dependencies
RUN npm ci
# Copy source code
COPY . .
# Build the application
RUN npm run build
# Stage 5: Production
FROM nginx:alpine AS production
# Copy built application
COPY --from=builder /app/dist /usr/share/nginx/html
# Copy nginx configuration
COPY docker/nginx.conf /etc/nginx/nginx.conf
# Expose port 80
EXPOSE 80
# Start nginx
CMD ["nginx", "-g", "daemon off;"]
# Stage 6: Development with hot reload (default)
FROM dev AS development
# This stage is used for development with hot reload
# Volume mounts will be handled by docker-compose
# Default to development stage
FROM development