Skip to content

Commit

Permalink
switch to docker multistage build
Browse files Browse the repository at this point in the history
  • Loading branch information
Jens Schulze committed Mar 2, 2018
1 parent 860063e commit ec6f7bc
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 15 deletions.
6 changes: 5 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
.idea
.gradle
.git
.git
out/
build/
src/ratpack/assets/bower_components/
src/ratpack/assets/node_modules/
8 changes: 0 additions & 8 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,3 @@ cache:

script:
- ./gradlew check

after_success:
- if [ "$TRAVIS_BRANCH" == "master" ]; then
./gradlew shadowJar;
docker build -t vrapio/vrap .;
docker login -u="$DOCKER_USERNAME" -p="$DOCKER_PASSWORD";
docker push vrapio/vrap;
fi
13 changes: 12 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,19 @@
FROM openjdk:8 as builder

RUN curl -sL https://deb.nodesource.com/setup_9.x | bash - \
&& apt-get update && apt-get install -y nodejs yarn \
&& node -v && npm -v

WORKDIR /vrap
COPY . /vrap

RUN ./gradlew clean shadowJar

FROM openjdk:8-jre-alpine

WORKDIR /app

ADD build/libs/vrap-all.jar /app/vrap.jar
COPY --from=builder /vrap/build/libs/vrap-all.jar /app/vrap.jar
ADD vrap.sh /app/vrap.sh

ENV JAVA_OPTS ""
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ run {
}


task copyConsolePatch(dependsOn: yarn_install, type: Copy) {
task copyConsolePatch(dependsOn: npmInstall, type: Copy) {
from "src/ratpack/assets/oauth2-authorization.html"
into "src/ratpack/assets/bower_components/oauth-authorization"
}
Expand Down
4 changes: 0 additions & 4 deletions docker_build.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
#!/usr/bin/env bash

echo "Building artifact:"
docker run --rm -v ${PWD}:/vrap -v${HOME}/.gradle:/root/.gradle -w /vrap openjdk:8-alpine ./gradlew shadowJar
echo "Done."

echo "Build runtime container:"
docker build --rm -t vrapio/vrap .
echo "Done."
12 changes: 12 additions & 0 deletions src/ratpack/assets/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit ec6f7bc

Please sign in to comment.