First, we install the Alpine packages we need:
- bash
- curl
- zip
- libstdc++ (Gradle needed this, but I don't think Groovy does :shrug:)
RUN apk add --update bash libstdc++ curl zip && \ rm -rf /var/cache/apk/*
Now we need a workaround for fact that Groovy's shell scripts start with #!/bin/sh :
# Workaround https://issues.apache.org/jira/browse/GROOVY-7906 and other 'busybox' related issues. RUN rm /bin/sh && ln -s /bin/bash /bin/sh
Now we can install Groovy. This could probably be done a little more optimally, but it works:
# Install groovy # Use curl -L to follow redirects # Also, use sed to make a workaround for https://issues.apache.org/jira/browse/GROOVY-7906 RUN curl -L https://bintray.com/artifact/download/groovy/maven/apache-groovy-binary-2.4.8.zip -o /tmp/groovy.zip && \ cd /usr/local && \ unzip /tmp/groovy.zip && \ rm /tmp/groovy.zip && \ ln -s /usr/local/groovy-2.4.8 groovy && \ /usr/local/groovy/bin/groovy -v && \ cd /usr/local/bin && \ ln -s /usr/local/groovy/bin/groovy groovy
As always, any suggestions about how to make it better, let me know.
groovy: JAVA_HOME not set and cannot find javac to deduce location, please set JAVA_HOME.
ReplyDeleteThanks for this. I used wget instead of curl but works perfectly.
ReplyDelete