Here is my .gitlab-ci.yml script.
before_script:
- uname -a
- apt-get install default-jre default-jdk openjdk-7-jre openjdk-7-jdk
- java -version
- export MODE="service"
- export PID_FOLDER="/var/run/gitlab-runner-test"
dev:
script:
- chmod +x gradlew
- ./gradlew assembleDebug
I am trying to run the script on gitlab.com page to compile a android project. I checked with some alterations to my script that there is no java installed on the ci linux Linux runner-8a2f473d-project-881036-concurrent-0 4.5.0-coreos-r1 #2 SMP Thu May 5 07:27:26 UTC 2016 x86_64 GNU/Linux.
I tried installing java, just like a sample which was shown for ruby, but it does not work, and gives an Unable to locate package error.
I am not sure what should be the package as it seems like a ubuntu system, but the command which works on my ubuntu does not work here.
This is not a local installation.
I believe you should be able to use the image
feature described here. I found success with the anapsix/alpine-java:jdk8
Docker image.
I am using my own Docker gitlab-runner with a custom Docker image as I need Maven with Oracle java. I'm not 100% on if the shared runner on gitlab.com allows you to use your own image.
My Dockerfile for that (which I upload to Gitlab and use their new Docker container register feature)
FROM anapsix/alpine-java:jdk8
ENV MAVEN_VERSION 3.3.3
RUN apk update && apk upgrade && apk add curl wget bash tar rsync openssh-client
RUN mkdir -p /usr/share/maven \
&& curl -fsSL http://apache.osuosl.org/maven/maven-3/$MAVEN_VERSION/binaries/apache-maven-$MAVEN_VERSION-bin.tar.gz \
| tar -xzC /usr/share/maven --strip-components=1 \
&& ln -s /usr/share/maven/bin/mvn /usr/bin/mvn \
&& rm -rf /tmp/* /var/cache/apk/*;
ENV MAVEN_HOME /usr/share/maven
ENTRYPOINT []
CMD ["bash"]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With