2

I was preparing a Docker image for my umbrella elixir application. I am using esbuild for assets compilation. esbuild is installed using as npm package.

Dockerfile:

# copy umbrella app
COPY ./apps/gpanel ./apps/gpanel

...

# compile assets
RUN mix assets.deploy

I got this error:

/app/apps/gpanel/assets/node_modules/esbuild/bin/esbuild: 1: Syntax error: word unexpected (expecting ")")
npm ERR! code 1
npm ERR! path /app/apps/gpanel/assets
npm ERR! command failed
npm ERR! command sh -c node esbuild.js --deploy
Adam Millerchip
  • 20,844
  • 5
  • 51
  • 74

1 Answers1

3

After some googling, I found that this is a cross-platform build incompatibility problem.

The root cause is that the node_modules folder was copied from my dev environment to the docker context.

Adding node_modules to .dockerignore solved the problem.