Skip to content

Commit 26e1ebd

Browse files
migrated Puppeteer checker to v3
1 parent faf3f17 commit 26e1ebd

File tree

14 files changed

+11222
-4115
lines changed

14 files changed

+11222
-4115
lines changed

checker-puppeteer/.gitignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# This file tells Git which files shouldn't be added to source control
2+
3+
.DS_Store
4+
.idea
5+
dist
6+
node_modules
7+
apify_storage
8+
storage
9+
storage

checker-puppeteer/Dockerfile

Lines changed: 44 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,52 @@
1-
FROM apify/actor-node-puppeteer-chrome:16
1+
# Specify the base Docker image. You can read more about
2+
# the available images at https://crawlee.dev/docs/guides/docker-images
3+
# You can also use any other image from Docker Hub.
4+
FROM apify/actor-node-puppeteer-chrome:16 AS builder
5+
6+
# Copy just package.json and package-lock.json
7+
# to speed up the build using Docker layer cache.
8+
COPY --chown=myuser package*.json ./
29

3-
# Copy the package.json and package-lock.json files, since they are the only files
4-
# that affect NPM install in the next step
5-
COPY package*.json ./
10+
# Install all dependencies. Don't audit to speed up the installation.
11+
RUN npm install --include=dev --audit=false
612

7-
# Install NPM packages, skip optional and development dependencies to keep the
8-
# image small. Avoid logging too much and print the dependency tree for debugging
13+
# Next, copy the source files using the user set
14+
# in the base image.
15+
COPY --chown=myuser . ./
916

10-
# Log Node version
11-
RUN echo "Node.js version:" && node --version
17+
# Install all dependencies and build the project.
18+
# Don't audit to speed up the installation.
19+
RUN npm run build
20+
21+
# Create final image
22+
FROM apify/actor-node-puppeteer-chrome:16
1223

13-
# Log npm version
14-
RUN echo "NPM version:" && npm --version
24+
# Copy only built JS files from builder image
25+
COPY --from=builder --chown=myuser /home/myuser/dist ./dist
1526

16-
# Install all runtime dependencies
27+
# Copy just package.json and package-lock.json
28+
# to speed up the build using Docker layer cache.
29+
COPY --chown=myuser package*.json ./
30+
31+
# Install NPM packages, skip optional and development dependencies to
32+
# keep the image small. Avoid logging too much and print the dependency
33+
# tree for debugging
1734
RUN npm --quiet set progress=false \
18-
&& npm ci --only=prod --no-optional \
19-
&& echo "Installed NPM packages:" \
20-
&& (npm ls || true)
35+
&& npm install --omit=dev --omit=optional \
36+
&& echo "Installed NPM packages:" \
37+
&& (npm list --omit=dev --all || true) \
38+
&& echo "Node.js version:" \
39+
&& node --version \
40+
&& echo "NPM version:" \
41+
&& npm --version \
42+
&& rm -r ~/.npm
2143

22-
# Next, copy the remaining files and directories with the built source code.
44+
# Next, copy the remaining files and directories with the source code.
2345
# Since we do this after NPM install, quick build will be really fast
24-
# for simple source file changes.
25-
COPY ./src ./dist
46+
# for most source file changes.
47+
COPY --chown=myuser . ./
48+
49+
50+
# Run the image. If you know you won't need headful browsers,
51+
# you can remove the XVFB start script for a micro perf gain.
52+
CMD ./start_xvfb_and_run_cmd.sh && npm run start:prod --silent

checker-puppeteer/apify.json

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
{
2-
"name": "website-checker-puppeteer",
3-
"version": "0.0.0",
2+
"name": "checker-puppeteer",
3+
"version": "0.0",
44
"buildTag": "latest",
5-
"env": null,
6-
"template": "basic"
5+
"env": null
76
}

0 commit comments

Comments
 (0)