1
- FROM apify/actor-node-chrome
1
+ # First, specify the base Docker image. You can read more about
2
+ # the available images at https://sdk.apify.com/docs/guides/docker-images
3
+ # You can also use any other image from Docker Hub.
4
+ FROM apify/actor-node:16
2
5
3
- # Copy source code
4
- COPY . ./
6
+ # Second, copy just package.json and package-lock.json since it should be
7
+ # the only file that affects "npm install" in the next step, to speed up the build
8
+ COPY package*.json ./
5
9
6
- # Install default dependencies, print versions of everything
10
+ # Install NPM packages, skip optional and development dependencies to
11
+ # keep the image small. Avoid logging too much and print the dependency
12
+ # tree for debugging
7
13
RUN npm --quiet set progress=false \
8
14
&& npm install --only=prod --no-optional \
9
15
&& echo "Installed NPM packages:" \
10
- && npm list \
16
+ && ( npm list --only=prod --no-optional --all || true) \
11
17
&& echo "Node.js version:" \
12
18
&& node --version \
13
19
&& echo "NPM version:" \
14
20
&& npm --version
21
+
22
+ # Next, copy the remaining files and directories with the source code.
23
+ # Since we do this after NPM install, quick build will be really fast
24
+ # for most source file changes.
25
+ COPY . ./
26
+
27
+ # Optionally, specify how to launch the source code of your actor.
28
+ # By default, Apify's base Docker images define the CMD instruction
29
+ # that runs the Node.js source code using the command specified
30
+ # in the "scripts.start" section of the package.json file.
31
+ # In short, the instruction looks something like this:
32
+ #
33
+ # CMD npm start
0 commit comments