-
Notifications
You must be signed in to change notification settings - Fork 49
Building and Running Tests in Docker
Chanseok Oh edited this page Dec 21, 2018
·
11 revisions
For example,
FROM ubuntu:18.04
RUN apt-get update && \
apt-get install -y vim openjdk-8-jdk maven python git curl libgtk-3-0 libswt-gtk-3-java xvfb ratpoison && \
cd && \
curl https://dl.google.com/dl/cloudsdk/channels/rapid/google-cloud-sdk.tar.gz | \
tar -zxf - && \
google-cloud-sdk/bin/gcloud components install app-engine-java --quiet
ENV JAVA_HOME /usr/lib/jvm/java-8-openjdk-amd64
ENV DISPLAY :99
CMD cd && \
git clone https://github.com/GoogleCloudPlatform/google-cloud-eclipse.git && \
( Xvfb :99 & ) && \
sleep 3 && \
( ratpoison & ) && \
( cd google-cloud-eclipse && \
mvn -V -B -N io.takari:maven:wrapper -Dmaven=3.5.0 && \
./mvnw -V -B --fail-at-end -Ptravis verify ) && \
tar -zcf m2-cache-new.tar.gz .m2
Or, the last part could just be
ENV JAVA_HOME /usr/lib/jvm/java-8-openjdk-amd64
CMD cd && \
git clone https://github.com/GoogleCloudPlatform/google-cloud-eclipse.git && \
cd google-cloud-eclipse && \
xvfb-run mvn verify
Build an image:
$ docker build -t ct4e-build-ubuntu .
Run in a container:
$ docker run ct4e-build-ubuntu
The Dockerfile
above can be used to collect JARs that Maven downloads into the local .m2
cache repository while building and testing CT4E. We can then use the generated cache file to speed up Kokoro Windows builds, which is what we currently do: https://github.com/GoogleCloudPlatform/google-cloud-eclipse/pull/3248/files
The scripts below may help uploading the .m2
cache file generated by the Dockerfile
.
#!/bin/sh
set -o errexit
set -o xtrace
build_in_container() {
[ ! -e m2-cache-new.tar.gz ]
docker run --name ct4e-build ct4e-build-ubuntu | tee ct4e-build.log
docker cp ct4e-build:/root/m2-cache-new.tar.gz .
docker rm ct4e-build
}
upload_m2_cache() {
[ -e m2-cache-new.tar.gz ]
gunzip m2-cache-new.tar.gz
gsutil cp m2-cache-new.tar gs://ct4e-m2-repositories-for-kokoro/m2-cache.tar
}
build_in_container
#upload_m2_cache
End User Documentation
- Installation and setup
- Creating a new project
- Running and debugging
- Deploying
- Cloud Tools for Eclipse Tutorial
- Migration from the Google Plugin for Eclipse (GPE)
Contributor Docs