apify/actor-node-puppeteer-chrome:18 builder problem

Hi. I little noobish question. How to add WORKDIR in dockerfile to make it work? I want to use volumes in docker-compose, but can't achive that. Here is my dockerfile:
# Specify the base Docker image. You can read more about
# the available images at https://crawlee.dev/docs/guides/docker-images
# You can also use any other image from Docker Hub.
FROM apify/actor-node-puppeteer-chrome:18 AS builder

# Copy just package.json and package-lock.json
# to speed up the build using Docker layer cache.
COPY --chown=myuser package*.json ./

# Install all dependencies. Don't audit to speed up the installation.
RUN npm install --include=dev --audit=false

# Next, copy the source files using the user set
# in the base image.
COPY --chown=myuser . ./

# Install all dependencies and build the project.
# Don't audit to speed up the installation.
RUN npm run build

# Create final image
FROM apify/actor-node-puppeteer-chrome:18

COPY --from=builder --chown=myuser /home/myuser/dist ./dist

RUN mkdir "app"
COPY --chown=myuser package*.json ./app

RUN npm --quiet set progress=false \
&& npm install --omit=dev --omit=optional \
&& echo "Installed NPM packages:" \
&& (npm list --omit=dev --all || true) \
&& echo "Node.js version:" \
&& node --version \
&& echo "NPM version:" \
&& npm --version

COPY --chown=myuser . ./app

CMD ./start_xvfb_and_run_cmd.sh && npm run start:prod --silent
# Specify the base Docker image. You can read more about
# the available images at https://crawlee.dev/docs/guides/docker-images
# You can also use any other image from Docker Hub.
FROM apify/actor-node-puppeteer-chrome:18 AS builder

# Copy just package.json and package-lock.json
# to speed up the build using Docker layer cache.
COPY --chown=myuser package*.json ./

# Install all dependencies. Don't audit to speed up the installation.
RUN npm install --include=dev --audit=false

# Next, copy the source files using the user set
# in the base image.
COPY --chown=myuser . ./

# Install all dependencies and build the project.
# Don't audit to speed up the installation.
RUN npm run build

# Create final image
FROM apify/actor-node-puppeteer-chrome:18

COPY --from=builder --chown=myuser /home/myuser/dist ./dist

RUN mkdir "app"
COPY --chown=myuser package*.json ./app

RUN npm --quiet set progress=false \
&& npm install --omit=dev --omit=optional \
&& echo "Installed NPM packages:" \
&& (npm list --omit=dev --all || true) \
&& echo "Node.js version:" \
&& node --version \
&& echo "NPM version:" \
&& npm --version

COPY --chown=myuser . ./app

CMD ./start_xvfb_and_run_cmd.sh && npm run start:prod --silent
THe problem is, docker is not using my app, but the default one. If there is no need to change it, how to add volumes from current working directory to docker current working directory (docker-compose)? Because of course it have to be absolute path.
0 Replies
No replies yetBe the first to reply to this messageJoin

Did you find this page helpful?