avh4 / avh4/elm-format

Elm-format not working in alpine docker image

Open
#665 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Haskell
Stars
1.3k
Forks
147
PR merge metrics
No merged PRs in 30d

Description

elm-format throwing errors inside a `node:12-alpine` image. Here's the error:
```docker build -t peter .
Sending build context to Docker daemon 3.072kB
Step 1/4 : FROM node:12-alpine
---> 1cbcaddb8074
Step 2/4 : RUN npm i -D elm-format
---> Using cache
---> b2dc0d58da8a
Step 3/4 : RUN echo "module Main exposing(..)\nimport Html\nmain = Html.text \"\"" > Main.elm
---> Running in 596e6b275b06
Removing intermediate container 596e6b275b06
---> 925d8ae6940c
Step 4/4 : RUN node_modules/.bin/elm-format --yes Main.elm
---> Running in 19b37765adb9
events.js:187
throw er; // Unhandled 'error' event
^

Error: spawn /node_modules/elm-format/unpacked_bin/elm-format ENOENT
at Process.ChildProcess._handle.onexit (internal/child_process.js:264:19)
at onErrorNT (internal/child_process.js:456:16)
at processTicksAndRejections (internal/process/task_queues.js:80:21)
Emitted 'error' event on ChildProcess instance at:
at Process.ChildProcess._handle.onexit (internal/child_process.js:270:12)
at onErrorNT (internal/child_process.js:456:16)
at processTicksAndRejections (internal/process/task_queues.js:80:21) {
errno: 'ENOENT',
code: 'ENOENT',
syscall: 'spawn /node_modules/elm-format/unpacked_bin/elm-format',
path: '/node_modules/elm-format/unpacked_bin/elm-format',
spawnargs: [ '--yes', 'Main.elm' ]
}
The command '/bin/sh -c node_modules/.bin/elm-format --yes Main.elm' returned a non-zero code: 1
```

SSCCE:
```
FROM node:12-alpine
RUN npm i -D elm-format
RUN echo "module Main exposing(..)\nimport Html\nmain = Html.text \"\"" > Main.elm
RUN node_modules/.bin/elm-format --yes Main.elm
```

Note when changing the image in the first line to just `node:12` (not alpine but ubuntu based) image, everything works.

Related issue #589

Contributor guide

No contributing guide indexed for this repository

Research direction

Reproduce the SSCCE with node:12-alpine and compare it with node:12, focusing on the failed node_modules/elm-format/unpacked_bin/elm-format spawn. Inspect how the npm package provides that binary and review related issue #589. Done means the supplied Docker build can run elm-format successfully in the Alpine image.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, dockerfile, node.js
Domain
devops, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.