Gradle build in docker

docker
gradle

#1

I am using docker and gradle.

I do the following, build the docker image.

… installing java/gradle etc, the unintresting bits
RUN mkdir -p /opt/content-api
COPY . /opt/content-api/
VOLUME /opt/content-api
WORKDIR /opt/content-api
RUN gradle build
ENTRYPOINT [“java”,"-Djava.security.egd=file:/dev/./urandom","-jar","/opt/content-api/build/libs/content-api.jar"]
EXPOSE 8080

This works fine on my OSX machine, as in when I build and run the docker, I can access the application on port 8080. But when I run this via CircleCI, the gradle build runs but the build folder which it generates is not present in the image, hence the entrypoint command fails.

I tried the ssh debug and when I log into the docker image, I see no signs of gradle build run, even though the logs on CircleCI show that gradle has run. Is it that some intermittent layer is not getting persisted.

Any help would be appreciated, I am doing an evaluation for my company before we can buy the plan.

Here is the circle.yml

machine:
  services:
    - docker
dependencies:
  override:
    - docker info
    - docker build -t content-api .
test:
  override:
    - docker run -d -p 8080:8080 content-api; sleep 20
    - curl --retry 10 --retry-delay 5 -v http://localhost:8080/index.html

#2