Create Dockerfile
Browse files- Dockerfile +64 -0
Dockerfile
ADDED
@@ -0,0 +1,64 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Use the official Node.js image as the base image
|
2 |
+
#FROM ghcr.io/puppeteer/puppeteer:latest
|
3 |
+
FROM node:14-slim
|
4 |
+
|
5 |
+
# Install latest chrome dev package and fonts to support major charsets (Chinese, Japanese, Arabic, Hebrew, Thai and a few others)
|
6 |
+
# Note: this installs the necessary libs to make the bundled version of Chromium that Puppeteer
|
7 |
+
# installs, work.
|
8 |
+
RUN apt-get update \
|
9 |
+
&& apt-get install -y wget gnupg \
|
10 |
+
&& wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \
|
11 |
+
&& sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list' \
|
12 |
+
&& apt-get update \
|
13 |
+
&& apt-get install -y google-chrome-stable fonts-ipafont-gothic fonts-wqy-zenhei fonts-thai-tlwg fonts-kacst fonts-freefont-ttf libxss1 \
|
14 |
+
--no-install-recommends \
|
15 |
+
&& rm -rf /var/lib/apt/lists/*
|
16 |
+
|
17 |
+
RUN apt-get install -y libnss3
|
18 |
+
|
19 |
+
|
20 |
+
# If running Docker >= 1.13.0 use docker run's --init arg to reap zombie processes, otherwise
|
21 |
+
# uncomment the following lines to have `dumb-init` as PID 1
|
22 |
+
# ADD https://github.com/Yelp/dumb-init/releases/download/v1.2.2/dumb-init_1.2.2_x86_64 /usr/local/bin/dumb-init
|
23 |
+
# RUN chmod +x /usr/local/bin/dumb-init
|
24 |
+
# ENTRYPOINT ["dumb-init", "--"]
|
25 |
+
|
26 |
+
# Uncomment to skip the chromium download when installing puppeteer. If you do,
|
27 |
+
# you'll need to launch puppeteer with:
|
28 |
+
# browser.launch({executablePath: 'google-chrome-stable'})
|
29 |
+
# ENV PUPPETEER_SKIP_DOWNLOAD true
|
30 |
+
|
31 |
+
# Install puppeteer so it's available in the container.
|
32 |
+
RUN npm init -y && \
|
33 |
+
npm i puppeteer \
|
34 |
+
# Add user so we don't need --no-sandbox.
|
35 |
+
# same layer as npm install to keep re-chowned files from using up several hundred MBs more space
|
36 |
+
&& groupadd -r pptruser && useradd -r -g pptruser -G audio,video pptruser \
|
37 |
+
&& mkdir -p /home/pptruser/Downloads \
|
38 |
+
&& chown -R pptruser:pptruser /home/pptruser \
|
39 |
+
&& chown -R pptruser:pptruser /node_modules \
|
40 |
+
&& chown -R pptruser:pptruser /package.json \
|
41 |
+
&& chown -R pptruser:pptruser /package-lock.json
|
42 |
+
|
43 |
+
|
44 |
+
# Set the working directory inside the container
|
45 |
+
WORKDIR /app
|
46 |
+
|
47 |
+
# Clone the code from the GitHub repository
|
48 |
+
#RUN git clone https://github.com/SokWith/getbing-cct-cookie .
|
49 |
+
COPY . .
|
50 |
+
|
51 |
+
# Install the dependencies
|
52 |
+
#RUN npm install axios
|
53 |
+
RUN npm install
|
54 |
+
|
55 |
+
# Expose the port that your application is listening on
|
56 |
+
EXPOSE 7860
|
57 |
+
|
58 |
+
|
59 |
+
# Run everything after as non-privileged user.
|
60 |
+
USER pptruser
|
61 |
+
|
62 |
+
# Start the application
|
63 |
+
CMD ["node", "index.js"]
|
64 |
+
#CMD ["google-chrome-stable"]
|