phantombuster / nickjs

Web scraping library made by the Phantombuster team. Modern, simple & works on all websites. (Deprecated)
https://nickjs.org
ISC License
500 stars 48 forks source link

Running NickJs in node:9-alpine #52

Closed AndrejHafner closed 4 years ago

AndrejHafner commented 5 years ago

I tried running NickJs in node9-alpine image and I get this error:

CHROME STDERR: [0204/101402.974481:WARNING:dns_config_service_posix.cc(326)] Failed to read DnsConfig.
CHROME STDERR: [0204/101402.984254:ERROR:devtools_http_handler.cc(759)] Error writing DevTools active port to file
> It took 105ms to start and connect to Chrome (1 tries)
{
  "level": "error",
  "message": "cannot connect to chrome tab: Error: Unknown command: protocol"
}

I have added the chromium browser to the image and set the CHROME_PATHto the chromium-browser. It is also present there, I checked with running a bash in the container. Does anyone know what to do?

My Dockerfile:

FROM node:9-alpine

ENV CHROME_PATH=/usr/bin/chromium-browser
ENV NICKJS_NO_SANDBOX=1
# ╒═════════════════════════
# │ Copy from builder
# ╘═════════════════════════
RUN mkdir -p /app
WORKDIR /app

# Node modules
COPY --from=builder /app-prod/node_modules ./node_modules

# App files
COPY --from=builder /app/dist ./dist
COPY --from=builder /app/res ./res

COPY --from=builder /app/package.json .
COPY --from=builder /app/util/healthcheck.js .
COPY --from=builder /app/start.sh .

RUN rm -f /app/dist/source.js /app/dist/source.js.map

# ╒═════════════════════════
# │ INSTALL NATIVE
# ╘═════════════════════════
# Install native app dependencies
RUN set -ex; \
  apk add --no-cache \
    rsync \
    openssh \
    udev \
    ttf-freefont \
    chromium

# ╒═════════════════════════
# │ SETUP HEALTH CHECK
# ╘═════════════════════════
HEALTHCHECK --interval=12s --timeout=12s --retries=3 --start-period=60s \
 CMD node ./util/healthcheck.js

# Run the container under "node" user by default
#USER node
CMD [ "npm", "run", "serve" ]
paps commented 5 years ago

Which version of Chromium is it? Did you try with google-chrome instead of chromium? That might do the trick