question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

It won't build with Docker

See original GitHub issue

When adding the prerender-spa-plugin to an existing app following the Vue doc : https://vuejs-templates.github.io/webpack/prerender.html or when cloning this repo’s examples, it can build both applications normally on my host (yarn 1.3.2, node 8.6.0) but not inside a container, with Docker.

I’ve tried the node:latest (9.0.0), node:carbon-alpine (8.9.0 on alpine), node:carbon and node_boron (6.11) images. I ran the build with npm (v3 and v5) and yarn (1.2.1). Nothing seems to make it work.

I also tried to give it my host’s node_modules, or fetch them inside the container, nothing helped.

Here’s the error thrown by the plugin:

[...]/node_modules/prerender-spa-plugin/lib/compile-to-html.js:82
                    if (error) throw stdout
                               ^

Full log:

yarn run v1.2.1
$ node build/build.js
(node:26) [DEP0022] DeprecationWarning: os.tmpDir() is deprecated. Use os.tmpdir() instead.

/usr/src/app/node_modules/prerender-spa-plugin/lib/compile-to-html.js:82
                    if (error) throw stdout
                               ^

error Command failed with exit code 1.

The Dockerfile is extremely simple (and works without the prerender-spa-plugin for the same app:

FROM node:carbon-alpine

WORKDIR /usr/src/app
COPY . .

RUN yarn && yarn build

Reproduction: Copy the above docker file and try to build the image docker build -t app .

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:3
  • Comments:6

github_iconTop GitHub Comments

7reactions
b12fcommented, Mar 15, 2018

This worked for us to get puppeteer running within a docker instance:

FROM node:latest

RUN apt-get install -yq gconf-service libasound2 libatk1.0-0 libc6 libcairo2 libcups2 libdbus-1-3 \
libexpat1 libfontconfig1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libnspr4 \
libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 \
libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 \
ca-certificates fonts-liberation libappindicator1 libnss3 lsb-release xdg-utils wget
1reaction
nekitkcommented, Dec 8, 2017

Solved this by using node:carbon-wheezy instead of carbon-alpine

Thanks to this discussion: https://github.com/marcbachmann/node-html-pdf/issues/233

Read more comments on GitHub >

github_iconTop Results From Across the Web

docker - Can't build Dockerfile - Stack Overflow
I'm running docker [Docker 18.06.1-ce, build e68fc7a] on an Ubuntu 18 ... 'can't stat '/home/aielloine/.docker/helloapp/dockerfiles''.
Read more >
Unable to build my docker image
I have a created a project as well as dockerfiles inside it. I'm trying to run it from docker but I keep getting...
Read more >
"docker build" immediately hangs indefinitely. Windows 10 #613
When I attempt to run a build command, docker simply freezes before producing ... (roughly a week later) and now they will not...
Read more >
Docker: “build” Requires 1 Argument Error - Baeldung
The most common reason for “Docker build Requires 1 Argument” error is when we try to build the image without providing sufficient arguments....
Read more >
Docker build failes with dockerfile created by VS
statement doesn't copy the files correctly. My new working dockerfile: This now builds correctly by VS and manual `docker build` executions, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found