Severian commited on
Commit
4c00dd2
·
1 Parent(s): 728217a

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +46 -12
Dockerfile CHANGED
@@ -1,23 +1,57 @@
1
- FROM node:18-alpine
 
 
 
 
2
 
3
- # Create app directory
4
  WORKDIR /app
5
 
6
- # Install app dependencies
7
- COPY package*.json ./
 
 
 
 
 
 
8
 
9
- RUN npm install
10
 
11
- # Bundle app source
 
12
  COPY . .
13
 
14
- # Change file permissions
15
- RUN chmod -R 755 .
 
 
 
 
 
16
 
17
- # Build the application
18
- RUN npm run build
 
 
19
 
20
- # Your app runs on port 3000
21
  EXPOSE 3000
22
 
23
- CMD [ "node", "run", "start" ]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM node:18-alpine AS base
2
+
3
+ FROM base AS deps
4
+
5
+ RUN apk add --no-cache libc6-compat
6
 
 
7
  WORKDIR /app
8
 
9
+ COPY package.json yarn.lock ./
10
+
11
+ RUN yarn config set registry 'https://registry.npmmirror.com/'
12
+ RUN yarn install
13
+
14
+ FROM base AS builder
15
+
16
+ RUN apk update && apk add --no-cache git
17
 
 
18
 
19
+ WORKDIR /app
20
+ COPY --from=deps /app/node_modules ./node_modules
21
  COPY . .
22
 
23
+ RUN yarn build
24
+
25
+ FROM base AS runner
26
+ WORKDIR /app
27
+
28
+ RUN apk add proxychains-ng
29
+
30
 
31
+ COPY --from=builder /app/public ./public
32
+ COPY --from=builder /app/.next/standalone ./
33
+ COPY --from=builder /app/.next/static ./.next/static
34
+ COPY --from=builder /app/.next/server ./.next/server
35
 
 
36
  EXPOSE 3000
37
 
38
+ CMD if [ -n "$PROXY_URL" ]; then \
39
+ export HOSTNAME="127.0.0.1"; \
40
+ protocol=$(echo $PROXY_URL | cut -d: -f1); \
41
+ host=$(echo $PROXY_URL | cut -d/ -f3 | cut -d: -f1); \
42
+ port=$(echo $PROXY_URL | cut -d: -f3); \
43
+ conf=/etc/proxychains.conf; \
44
+ echo "strict_chain" > $conf; \
45
+ echo "proxy_dns" >> $conf; \
46
+ echo "remote_dns_subnet 224" >> $conf; \
47
+ echo "tcp_read_time_out 15000" >> $conf; \
48
+ echo "tcp_connect_time_out 8000" >> $conf; \
49
+ echo "localnet 127.0.0.0/255.0.0.0" >> $conf; \
50
+ echo "localnet ::1/128" >> $conf; \
51
+ echo "[ProxyList]" >> $conf; \
52
+ echo "$protocol $host $port" >> $conf; \
53
+ cat /etc/proxychains.conf; \
54
+ proxychains -f $conf node server.js; \
55
+ else \
56
+ node server.js; \
57
+ fi