forked from s045pd/CursedChrome
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
52 lines (41 loc) · 1.67 KB
/
Dockerfile
File metadata and controls
52 lines (41 loc) · 1.67 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
# ============================================
# Stage 1: Build GUI
# ============================================
FROM node:12-alpine AS gui-builder
WORKDIR /work/gui
COPY gui/package.json gui/package-lock.json ./
RUN npm install --production=false && npm cache clean --force
COPY gui/ ./
RUN npm run build && rm -rf node_modules
# ============================================
# Stage 2: Production dependencies
# ============================================
FROM node:12-alpine AS deps
WORKDIR /work
COPY package.json package-lock.json ./
# Install build dependencies for native modules (bcrypt)
RUN apk add --no-cache python2 make g++
# Use npm install instead of npm ci (lock file may be out of sync)
RUN npm install --production --legacy-peer-deps && npm cache clean --force
# ============================================
# Stage 3: Final minimal production image
# ============================================
FROM node:12-alpine AS production
# Install only essential runtime dependencies
# python and build tools needed for some native modules
RUN apk add --no-cache ffmpeg python2 make g++
WORKDIR /work
# Copy production node_modules from deps stage
COPY --from=deps /work/node_modules ./node_modules
# Copy built GUI
COPY --from=gui-builder /work/gui/dist ./gui/dist
# Copy anyproxy library
COPY anyproxy/ ./anyproxy/
# Copy only essential application files
COPY utils.js api-server.js server.js database.js docker-entrypoint.sh package.json ./
# Ensure entrypoint is executable
RUN chmod +x /work/docker-entrypoint.sh
# Clean up build dependencies to reduce size
RUN apk del python2 make g++ && \
rm -rf /root/.npm /tmp/* /var/cache/apk/*
ENTRYPOINT ["/work/docker-entrypoint.sh"]