build-image
build-image copied to clipboard
Elm 0.19.1
Is there a possibility of providing the latest version of the elm compiler in this build image (0.19.1), rather than an old version (0.19.0)?
I'm able to to deploy elm projects via Netlify with just a Makefile, and I love it. I use npx in the Makefile to obtain dependencies for the build. The issue is that the npx elm make command uses the elm compiler already present (0.19.0), not the latest elm 0.19.1, as it might in the absence of any installed elm.
I can install the latest elm compiler in the build command with npm i -g [email protected], but this is less optimal than using the included elm compiler, if possible.
The Dockerfile specifies ELM_VERSION=0.19.0-bugfix6
Hey, so I'm planning on trying to make a PR to add support for this. I'm not too familiar with elm so if you're still interested in trying to get 0.19.1 to work let me know!
I think I figured out what needs to be modified in the dockerfile but I won't be able to test it on my local machine until Friday before submitting a PR.
@ModestMC Great! I'd be glad to work with you on this. However, I have never run a local netlify build, so I wouldn't be able to easily test it without the web interface.
If the result of elm --version during a build is 0.19.1, that would be considered a solution for me! (rather than 0.19.0).
Basically, the elm compiler (elm on the command line) needs a global installation, like node. So it needs to be present in the build environment.
There are no options via the netlify dashboard to choose the Elm version, so we're reliant on the one specified in the Dockerfile.
A workaround is to install elm globally with npm (npm i -g [email protected]) within the build environment before using it to compile Elm files. This works, but it's very slow for compiling a few files.
Hey @andrew-pyle, very happy to have you aboard! So, updates:
- I got access to the machine I needed to be able to use docker and currently have it installed.
- I followed along with Netlify's build guide on this repo, and replicated the "wrong elm version lol" issue
- I then cloned this repo, modified the Dockerfile to have the updated version of Elm, and tried using the script they have laid out again. Gave me the same Elm error. I realized this is likely because I'm using the same Docker image they have you clone at the beginning of the README, rather than building the image from the (now modified) Dockerfile. Currently, I'm running docker build ./ in the main directory for this repo with no further flags. It is painfully slow to watch and I have no idea what will happen. I'm worried some of the contexts will be gone; if it doesn't work, I'm going to hit up the Netlify people about posting the full build command they used to build the images they have public for this repo. Some random thing flashed Ubuntu 16.04 at me before flying by so my vibe is this might not work (using 18.04).
Do you have a machine where you can use Docker? The VM I spawned has 2 cores and 8 gb ram so this build process is like watching paint dry. I'm debating creating a branch, if this works the PR will be simple (thankfully) and there will be no need.
Once I can actually deploy elm the way I'm wanting to, I'd love to learn whatever you're willing to teach!
@ModestMC I went through the same process as you did, and got stuck trying to build a new version of the docker build image (to replace netlify/build:xenial on dockerhub). I just forked this repo and ran docker build . This new docker image was not able to run any build scripts—I got errors I didn't quite know what to make of.
I believe the command used to build the docker image is in the Jenkinsfile. I've never used Jenkins, so I don't know if there's some special information in there.
sh "docker build --build-arg NF_IMAGE_VERSION=${env.GIT_COMMIT} --build-arg NF_IMAGE_TAG=${env.BRANCH_NAME} -t netlify/build:${env.BRANCH_NAME} -t netlify/build:${env.GIT_COMMIT} ."
At any rate, I think we can just open a PR with the following change in the Dockerfile:
- ENV ELM_VERSION=0.19.0-bugfix6
+ ENV ELM_VERSION=latest-0.19.1
This will get transformed into a npm install -g [email protected] later in the Dockerfile, which is the version of elm I'm wanting.
@ModestMC I went ahead and opened a PR for this change, to hopefully get someone in this conversation who knows more than we do.
We're now installing 0.19.1 by default (in focal): https://github.com/netlify/build-image/blob/0f09b1e57bb09d602fa316a80cc642fc8245329b/Dockerfile#L222-L230
I believe this should fix the issue. Please reopen if not fixed.