-
-
Notifications
You must be signed in to change notification settings - Fork 120
maint(developer): add docker image to build developer node modules #14058
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Also update build documentation. Fixes: #14045 Test-bot: skip
User Test ResultsTest specification and instructions User tests are not required |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tried to run this on my machine, failed:
marc@QUAMBY MINGW64 /d/Projects/keyman/app (maint/developer/14045_docker)
$ ./resources/docker-images/build.sh :developer
[resources/docker-images] Local build environment detected: setting --debug
[resources/docker-images] build.sh parameters: <:developer --debug>
[resources/docker-images] Building image for base
noble: Pulling from library/ubuntu
0622fac788ed: Pull complete
Digest: sha256:6015f66923d7afbc53558d7ccffd325d43b4e249f41a6e93eef074c9505d2233
Status: Downloaded newer image for ubuntu:noble
docker.io/library/ubuntu:noble
What's next:
View a summary of image vulnerabilities and recommendations → docker scout quickview ubuntu:noble
[+] Building 82.3s (10/13) docker:desktop-linux
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 2.14kB 0.0s
=> [internal] load metadata for docker.io/library/ubuntu:noble 0.0s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0s
=> [ 1/10] FROM docker.io/library/ubuntu:noble 0.0s
=> [ 2/10] RUN grep ubuntu /etc/passwd && userdel ubuntu || true && rm -rf /home/ubuntu && useradd -c "Build user" --uid 1000 --home-dir /home/b 0.9s
=> [ 3/10] RUN apt-get -q -y update && apt-get -q -y install ca-certificates curl gnupg meson software-properties-common sudo && if [[ "$(lsb_ 75.5s
=> [ 4/10] RUN apt-get -q -y update && apt-get -q -y upgrade 3.5s
=> [ 5/10] RUN echo "build ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers 0.5s
=> [ 6/10] RUN <<EOF cat > /usr/bin/bashwrapper 0.5s
=> ERROR [ 7/10] RUN NVM_RELEASE=$(curl -s https://api.github.com/repos/nvm-sh/nvm/releases/latest | grep tag_name | cut -d : -f 2 | cut -d '"' -f 2 1.2s
------
> [ 7/10] RUN NVM_RELEASE=$(curl -s https://api.github.com/repos/nvm-sh/nvm/releases/latest | grep tag_name | cut -d : -f 2 | cut -d '"' -f 2) && curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/${NVM_RELEASE}/install.sh | bash:
1.040 % Total % Received % Xferd Average Speed Time Time Time Current
1.040 Dload Upload Total Spent Left Speed
100 450 100 450 0 0 3252 0 --:--:-- --:--:-- --:--:-- 3237
1.178 bash: line 2: syntax error near unexpected token `newline'
1.178 bash: line 2: `<?xml version="1.0" encoding="utf-8"?>'
------
Dockerfile:44
--------------------
43 | # Install NVM
44 | >>> RUN NVM_RELEASE=$(curl -s https://api.github.com/repos/nvm-sh/nvm/releases/latest | grep tag_name | cut -d : -f 2 | cut -d '"' -f 2) && \
45 | >>> curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/${NVM_RELEASE}/install.sh | bash
46 | RUN <<EOF cat >> /usr/bin/bashwrapper
--------------------
ERROR: failed to solve: process "/bin/bash -c NVM_RELEASE=$(curl -s https://api.github.com/repos/nvm-sh/nvm/releases/latest | grep tag_name | cut -d : -f 2 | cut -d '\"' -f 2) && curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/${NVM_RELEASE}/install.sh | bash" did not complete successfully: exit code: 2
Thanks a lot for working on this! Having a Docker image will be a big help. |
@cvosoft Does it work for you? |
@mcdurdin Can you please try again? I don't know where it would get a XML file from, so it might have been a network glitch that returned an error page instead of nvm's |
Co-authored-by: Marc Durdin <marc@durdin.net>
Yes, it built this time. However, attempting to run.sh on Windows fails:
(Separate question, why does build.sh use targets e.g. |
christoph@desktop:/media/daten/CODING/keyman/resources/docker-images/linux$ docker build -t keyman-dev-env . It seems like the base image keymanapp/keyman-base-ci is not publicly accessible (yet?), so the build fails for me at that point. |
@cvosoft Use the
|
Quick update: I was able to successfully build the I'm now working on running the tests with coverage using |
I was able to successfully build the
[resources/docker-images] Local build environment detected: setting --debug |
@cvosoft @mcdurdin You're both getting similar errors regarding
Also, what version of docker do you have ( |
christoph@desktop:/media/daten/CODING/keyman/resources/docker-images$ ./run.sh developer -- /bin/bash I am unable to start the container. christoph@desktop:/media/daten/CODING/keyman/resources/docker-images$ docker --version |
…`run.sh` This adjusts `resources/docker-images/run.sh` to more closely match the syntax in `build.sh`.
When running Docker on Windows Docker is not able to properly adjust to the line ending. When it builds the image from a Dockerfile that's checked out with the Windows-style line endings (\r\n), and it runs a command like ```Dockerfile RUN <<EOF cat > /usr/bin/bashwrapper echo "Hello world!" EOF ``` it makes the filename `/usr/bin/bashwrapper\r`! This change works around this problem by always using LF line endings for `resources/docker-images/**/Dockerfile`.
This change verifies that `docker buildx` is available and then uses that for building the images. For that we apparently need the magic line at the top of the `Dockerfile`s and set the environment variable `DOCKER_BUILDKIT`. This solves a problem building docker images on Linux with an older Docker version where the heredocs didn't work.
@cvosoft I think I found and fixed the problem. Can you please try again with the latest changes from (There were actually two different problems on Windows and on Ubuntu) NOTE:* the |
8000
Very well done! Building (after installing docker-buildx) worked fine. And also running with the new syntax ( :developer) works. Thanks! |
Sadly, on Windows, the image is now building, but run.sh is giving bad results.
Running bash works now, but I'm not sure I understand the filesystem as it stands; weird
|
73416a1
to
215bd6b
Compare
215bd6b
to
33fe775
Compare
I created #14153 for the problems running on Windows since this seems to be a general problem and not directly related to this PR. |
Changes in this pull request will be available for download in Keyman version 19.0.61-alpha |
Also update build documentation.
Fixes: #14045
Test-bot: skip