Epikcoder commited on
Commit
c7d3810
·
1 Parent(s): a26bc91

varo gendeng

Browse files
Files changed (1) hide show
  1. Dockerfile +48 -48
Dockerfile CHANGED
@@ -1,64 +1,66 @@
 
1
  FROM node:20-alpine
2
 
3
  # Set the working directory
4
  WORKDIR /app
5
 
6
  # Copy the application files to the container
7
- ADD . /app
8
-
9
 
 
10
  ENV LANG en_US.UTF-8
11
  ENV LANGUAGE en_US:en
12
  ENV LC_ALL en_US.UTF-8
 
 
13
  ENV GLIBC_REPO=https://github.com/sgerrand/alpine-pkg-glibc
14
  ENV GLIBC_VERSION=2.34-r0
15
  RUN set -ex && \
16
- apk --update add libstdc++ curl ca-certificates && \
17
- for pkg in glibc-${GLIBC_VERSION} glibc-bin-${GLIBC_VERSION}; \
18
- do curl -sSL ${GLIBC_REPO}/releases/download/${GLIBC_VERSION}/${pkg}.apk -o /tmp/${pkg}.apk; done && \
19
- apk add --allow-untrusted /tmp/*.apk && \
20
- rm -v /tmp/*.apk && \
21
  /usr/glibc-compat/sbin/ldconfig /lib /usr/glibc-compat/lib
22
 
23
  # Install prerequisites and helper packages
24
  RUN apk add --no-cache \
25
- bash dpkg xeyes
 
 
26
 
27
- # Download and unpack Chrome
28
- RUN set -ex && \
29
- curl -SL https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb -o /google-chrome-stable_current_amd64.deb && \
30
- dpkg -x /google-chrome-stable_current_amd64.deb google-chrome-stable && \
31
- mv /google-chrome-stable/usr/bin/* /usr/bin && \
32
- mv /google-chrome-stable/usr/share/* /usr/share && \
33
- mv /google-chrome-stable/etc/* /etc && \
34
- mv /google-chrome-stable/opt/* /opt && \
35
- rm -r /google-chrome-stable
36
-
37
- # Install Chrome dependencies
38
- RUN apk add --no-cache --update \
39
- alsa-lib \
40
- atk \
41
- at-spi2-atk \
42
- expat \
43
- glib \
44
- gtk+3.0 \
45
- libdrm \
46
- libx11 \
47
- libxcomposite \
48
- libxcursor \
49
- libxdamage \
50
- libxext \
51
- libxi \
52
- libxrandr \
53
- libxscrnsaver \
54
- libxshmfence \
55
- libxtst \
56
- mesa-gbm \
57
- nss \
58
- pango
59
 
60
- # Install necessary packages
61
- RUN apk --update --upgrade add --no-cache \
62
  font-noto \
63
  font-noto-cjk \
64
  font-noto-extra \
@@ -76,23 +78,21 @@ RUN apk --update --upgrade add --no-cache \
76
  librsvg-dev \
77
  cairo \
78
  pango \
79
- # chromium \
80
- nss \
81
  freetype \
82
  harfbuzz \
83
  ttf-freefont
84
 
 
85
  ENV PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium-browser
86
 
 
87
  RUN npm install
88
- RUN npm install
89
-
90
 
91
- # Link the resolver library
92
  RUN ln -s /lib/libresolv.so.2 /usr/lib/libresolv.so.2
93
 
94
  # Expose the application port
95
  EXPOSE 7860
96
 
97
  # Start the application
98
- CMD ["node", "beta.js"]
 
1
+ # Use the latest Node.js 20.x version on Alpine
2
  FROM node:20-alpine
3
 
4
  # Set the working directory
5
  WORKDIR /app
6
 
7
  # Copy the application files to the container
8
+ COPY . /app
 
9
 
10
+ # Set locale environment variables
11
  ENV LANG en_US.UTF-8
12
  ENV LANGUAGE en_US:en
13
  ENV LC_ALL en_US.UTF-8
14
+
15
+ # Install glibc for compatibility with applications requiring it
16
  ENV GLIBC_REPO=https://github.com/sgerrand/alpine-pkg-glibc
17
  ENV GLIBC_VERSION=2.34-r0
18
  RUN set -ex && \
19
+ apk --no-cache add libstdc++ curl ca-certificates && \
20
+ curl -sSL ${GLIBC_REPO}/releases/download/${GLIBC_VERSION}/glibc-${GLIBC_VERSION}.apk -o /tmp/glibc.apk && \
21
+ curl -sSL ${GLIBC_REPO}/releases/download/${GLIBC_VERSION}/glibc-bin-${GLIBC_VERSION}.apk -o /tmp/glibc-bin.apk && \
22
+ apk add --no-cache --allow-untrusted /tmp/glibc.apk /tmp/glibc-bin.apk && \
23
+ rm -rf /tmp/*.apk && \
24
  /usr/glibc-compat/sbin/ldconfig /lib /usr/glibc-compat/lib
25
 
26
  # Install prerequisites and helper packages
27
  RUN apk add --no-cache \
28
+ bash \
29
+ dpkg \
30
+ xeyes
31
 
32
+ # Install Chrome dependencies and download Chrome
33
+ RUN apk add --no-cache \
34
+ alsa-lib \
35
+ atk \
36
+ at-spi2-atk \
37
+ expat \
38
+ glib \
39
+ gtk+3.0 \
40
+ libdrm \
41
+ libx11 \
42
+ libxcomposite \
43
+ libxcursor \
44
+ libxdamage \
45
+ libxext \
46
+ libxi \
47
+ libxrandr \
48
+ libxscrnsaver \
49
+ libxshmfence \
50
+ libxtst \
51
+ mesa-gbm \
52
+ nss \
53
+ pango && \
54
+ curl -SL https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb -o /google-chrome-stable_current_amd64.deb && \
55
+ dpkg -x /google-chrome-stable_current_amd64.deb google-chrome-stable && \
56
+ mv /google-chrome-stable/usr/bin/* /usr/bin && \
57
+ mv /google-chrome-stable/usr/share/* /usr/share && \
58
+ mv /google-chrome-stable/etc/* /etc && \
59
+ mv /google-chrome-stable/opt/* /opt && \
60
+ rm -r /google-chrome-stable
 
 
 
61
 
62
+ # Install additional packages
63
+ RUN apk add --no-cache \
64
  font-noto \
65
  font-noto-cjk \
66
  font-noto-extra \
 
78
  librsvg-dev \
79
  cairo \
80
  pango \
 
 
81
  freetype \
82
  harfbuzz \
83
  ttf-freefont
84
 
85
+ # Set the Puppeteer executable path environment variable (if needed)
86
  ENV PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium-browser
87
 
88
+ # Install Node.js dependencies
89
  RUN npm install
 
 
90
 
91
+ # Link the resolver library (if needed)
92
  RUN ln -s /lib/libresolv.so.2 /usr/lib/libresolv.so.2
93
 
94
  # Expose the application port
95
  EXPOSE 7860
96
 
97
  # Start the application
98
+ CMD ["node", "beta.js"]