Skip to content
This repository has been archived by the owner on Mar 28, 2020. It is now read-only.

Commit

Permalink
Docker support #6
Browse files Browse the repository at this point in the history
- Don't mount gradle caches from local FS
- Pre-fetch gradle dependencies before copying sources to cache them
  • Loading branch information
sergeytrasko committed Oct 5, 2017
1 parent 3565fd5 commit 1c70d74
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
17 changes: 10 additions & 7 deletions Dockerfile.dev
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,18 @@ FROM gradle:4.1-jdk8-alpine
# Gradle image creates a 'gradle' user, so fallback to 'root' to do initial setup
USER root

RUN mkdir -p /opt/app \
&& mkdir -p /opt/.gradle
ENV GRADLE_USER_HOME /opt

RUN mkdir -p /opt/app
WORKDIR /opt/app

COPY .env .
COPY settings.gradle .
# Copy gradle build scripts
COPY .env settings.gradle ./
COPY api/build.gradle api/dotenv.gradle ./api/

# Release gradle caches if any
RUN find /opt/.gradle -type f -name "*.lock" | while read f; do rm $f; done
# Fetch dependencies - do it before copying the source code to cache the layer
RUN ["gradle", "--no-daemon"]

ENTRYPOINT ["gradle", "-g", "/opt/.gradle"]
COPY api api

ENTRYPOINT ["gradle", "--no-daemon"]
1 change: 0 additions & 1 deletion docker-compose.test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,4 @@ services:
context: .
dockerfile: Dockerfile.dev
volumes:
- $HOME/.gradle/caches:/opt/.gradle/caches
- ${PWD}/api:/opt/app/api
1 change: 0 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ services:
context: .
dockerfile: Dockerfile.dev
volumes:
- $HOME/.gradle/caches:/opt/.gradle/caches
- ${PWD}/api:/opt/app/api
ports:
- "8080:8080"
Expand Down

0 comments on commit 1c70d74

Please sign in to comment.