Failed to compile without a TTY (example: docker build)
See original GitHub issueThis is a
- Bug Report
- Feature Request
- Other
Hi guys,
First I want to thank you for your amazing work on Nexe!
Unfortunately, I have a bug when using it without a TTY.
In my case, I use it in a dockerfile. When I run docker build, nexe doesn’t have a TTY attached on.
If I use the option “-i”, like in nexe -i app.js
, the binary file seems to not having any code of my app.js file.
I think this is because of this code: https://github.com/nexe/nexe/blob/master/src/options.ts#L195-L210
Here is a dockerfile example:
FROM alpine:3.7
RUN apk --no-cache add nodejs nodejs-npm util-linux
RUN npm i -g nexe
RUN echo "console.log('ok');" > test.js
# First example
RUN cat test.js | nexe -t alpine-x64-8.9.4 -o test1
RUN ./test1 | grep ok
# Second example with script that simulate a TTY
RUN script --return -c 'nexe -t alpine-x64-8.9.4 -i test.js -o test2'
RUN ./test2 | grep ok
# Third example that failed
RUN nexe -t alpine-x64-8.9.4 -i test -o test3
RUN ./test3 | grep ok
Just run a docker build .
to see the result
Best, Adrien
Issue Analytics
- State:
- Created 6 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
'docker build' gives error that 'docker run' doesn't. How are ...
Is the 'docker build' command actually trying to add the 'build' folder to the image from which containers are launched? Or is it...
Read more >docker build - Docker Documentation
The build process can refer to any of the files in the context. For example, your build can use a COPY instruction to...
Read more >5 Steps to Compile Yocto Using Docker Containers - Witekio
How to create a Docker container for compiling Yocto ... If Docker is not included in the software repository of your distro or...
Read more >Containerize an app with Docker tutorial - .NET - Microsoft Learn
Build a Docker image; Create and run a Docker container. You'll understand the Docker container build and deploy tasks for a .NET application....
Read more >Troubleshooting AWS CodeBuild
ErrorCode: 500"; Error: "Cannot connect to the Docker daemon" when running a build; Error: "CodeBuild is not authorized to perform: sts:AssumeRole" when ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
The bug in the issue title, “Failed to compile without a TTY” is actually not fixed. As @alecdwm mentioned,
--enableStdIn=''
can be used to work around this issue. Either this flag should be documented or this parthttps://github.com/nexe/nexe/blob/02481f069c9462f6e0571974f603210a2578fe51/src/steps/cli.ts#L40-L43
needs to address the situation when
stdin
is not a TTY but is also not used, i.e. EOF.Alternatively, use
--input -
to denote thatstdin
should be used as input file, like many UNIX tools do.Interesting. Thanks for the note @alecdwm!