forked from cleanappio/cleanapp-frontend
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.template
More file actions
89 lines (74 loc) · 2.98 KB
/
Dockerfile.template
File metadata and controls
89 lines (74 loc) · 2.98 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
78
79
80
81
82
83
84
85
86
87
88
89
# Stage 1: Build the application
FROM node:24-slim AS builder
# Set working directory
WORKDIR /app
# Set environment variables
ENV NEXT_PUBLIC_API_URL={{NEXT_PUBLIC_API_URL}}
ENV NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY={{NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY}}
ENV NEXT_PUBLIC_MAPBOX_ACCESS_TOKEN={{NEXT_PUBLIC_MAPBOX_ACCESS_TOKEN}}
ENV NEXT_PUBLIC_GOOGLE_MAPS_API_KEY={{NEXT_PUBLIC_GOOGLE_MAPS_API_KEY}}
ENV NEXT_PUBLIC_LIVE_API_URL={{NEXT_PUBLIC_LIVE_API_URL}}
ENV NEXT_PUBLIC_TAGS_API_URL={{NEXT_PUBLIC_TAGS_API_URL}}
ENV NEXT_PUBLIC_WEBSOCKET_LIVE_API_URL={{NEXT_PUBLIC_WEBSOCKET_LIVE_API_URL}}
ENV NEXT_PUBLIC_EMBEDDED_MODE={{NEXT_PUBLIC_EMBEDDED_MODE}}
ENV NEXT_PUBLIC_MONTENEGRO_API_URL={{NEXT_PUBLIC_MONTENEGRO_API_URL}}
ENV NEXT_PUBLIC_DEVCONNECT2025_API_URL={{NEXT_PUBLIC_DEVCONNECT2025_API_URL}}
ENV NEXT_PUBLIC_EDGE_CITY_API_URL={{NEXT_PUBLIC_EDGE_CITY_API_URL}}
ENV NEXT_PUBLIC_NEW_YORK_API_URL={{NEXT_PUBLIC_NEW_YORK_API_URL}}
ENV NEXT_PUBLIC_REDBULL_API_URL={{NEXT_PUBLIC_REDBULL_API_URL}}
ENV NEXT_PUBLIC_AUTH_API_URL={{NEXT_PUBLIC_AUTH_API_URL}}
ENV NEXT_PUBLIC_AREAS_API_URL={{NEXT_PUBLIC_AREAS_API_URL}}
ENV NEXT_PUBLIC_PLAYSTORE_URL={{NEXT_PUBLIC_PLAYSTORE_URL}}
ENV NEXT_PUBLIC_APPSTORE_URL={{NEXT_PUBLIC_APPSTORE_URL}}
ENV NEXT_PUBLIC_REF_API_URL={{NEXT_PUBLIC_REF_API_URL}}
ENV NEXT_PUBLIC_REPORT_PROCESSING_API_URL={{NEXT_PUBLIC_REPORT_PROCESSING_API_URL}}
ENV NEXT_PUBLIC_EMAIL_API_URL={{NEXT_PUBLIC_EMAIL_API_URL}}
ENV NEXT_PUBLIC_WEBSITE_URL={{NEXT_PUBLIC_WEBSITE_URL}}
ENV NEXT_PUBLIC_REPORT_COUNT_URL={{NEXT_PUBLIC_REPORT_COUNT_URL}}
ENV NEXT_PUBLIC_RENDERER_API_URL={{NEXT_PUBLIC_RENDERER_API_URL}}
# Install system dependencies required for canvas and native modules
RUN apt-get update && apt-get install -y \
python3 \
make \
g++ \
libcairo2-dev \
libpango1.0-dev \
libjpeg-dev \
libgif-dev \
librsvg2-dev \
&& rm -rf /var/lib/apt/lists/*
# Install dependencies
COPY package.json package-lock.json* ./
RUN npm install
# Copy next.config.js first to ensure it's available
COPY next.config.js ./
# Copy all files and build the app
COPY . .
# Ensure next.config.js is properly copied and has correct permissions
RUN ls -la next.config.js || echo "next.config.js not found"
RUN cat next.config.js
RUN npm run build
# Stage 2: Run the application with minimal footprint
FROM node:24-slim AS runner
# Set environment variables
ENV NODE_ENV=production
# Set working directory
WORKDIR /app
# Install runtime dependencies for canvas
RUN apt-get update && apt-get install -y \
libcairo2 \
libpango-1.0-0 \
libjpeg62-turbo \
libgif7 \
librsvg2-2 \
&& rm -rf /var/lib/apt/lists/*
# Only copy necessary files from the builder stage
COPY --from=builder /app/public ./public
COPY --from=builder /app/.next ./.next
COPY --from=builder /app/node_modules ./node_modules
COPY --from=builder /app/package.json ./package.json
COPY --from=builder /app/next.config.js ./next.config.js
# Expose the port Next.js will run on
EXPOSE 3000
# Run the Next.js app
CMD ["npm", "start"]