-
Notifications
You must be signed in to change notification settings - Fork 307
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #92 from georg-schwarz/travis-ci
Dockerization and TravisCI
- Loading branch information
Showing
6 changed files
with
107 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
language: bash | ||
|
||
services: | ||
- docker | ||
|
||
env: | ||
global: | ||
- IMAGE_NAME=${DOCKERHUB_USER}/wahlzeit | ||
- IMAGE_NAME_TAGGED=${DOCKERHUB_USER}/wahlzeit:${TRAVIS_TAG} | ||
|
||
script: | ||
- docker build -t ${IMAGE_NAME} . | ||
|
||
deploy: | ||
- provider: script | ||
script: | ||
docker login -u ${DOCKERHUB_USER} -p ${DOCKERHUB_PW} && docker push ${IMAGE_NAME} | ||
on: | ||
branch: master | ||
|
||
- provider: script | ||
script: docker login -u ${DOCKERHUB_USER} -p ${DOCKERHUB_PW} && docker tag ${IMAGE_NAME} ${IMAGE_NAME_TAGGED} && docker push ${IMAGE_NAME_TAGGED} | ||
on: | ||
tags: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
######################################################### | ||
# First stage: image to build the application # | ||
######################################################### | ||
FROM adoptopenjdk/openjdk8-openj9:alpine-slim as builder | ||
|
||
WORKDIR /builder | ||
|
||
# Copy Gradle file | ||
COPY *.gradle /builder/ | ||
|
||
# Copy sources | ||
COPY src /builder/src | ||
|
||
# Copy Gradle resources | ||
COPY gradle /builder/gradle | ||
COPY gradlew /builder/gradlew | ||
|
||
# Test project | ||
RUN ./gradlew test | ||
|
||
# Build project (downloads Appengine SDK + builds + explode WAR) | ||
RUN ./gradlew appengineExplodeApp | ||
|
||
######################################################### | ||
# Second stage: image to run the application # | ||
######################################################### | ||
FROM adoptopenjdk/openjdk8-openj9:alpine-slim | ||
|
||
RUN mkdir /app | ||
WORKDIR /app | ||
|
||
# Pull the built files from the builder container | ||
COPY --from=builder /builder/build /app/build | ||
|
||
# Pull the Appengine SDK from the builder container | ||
COPY --from=builder /root/.gradle/appengine-sdk/appengine-java-sdk-1.9.76/ /root/.gradle/appengine-sdk/appengine-java-sdk-1.9.76/ | ||
|
||
# Expose port | ||
EXPOSE 8080 | ||
|
||
# Do the same as ./gradlew appengineRun for starting the dev server | ||
ENTRYPOINT ["/opt/java/openjdk/bin/java", "-Xdebug", "-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8000", "-Dfile.encoding=UTF-8", "-classpath", "/root/.gradle/wrapper/dists/gradle-4.10-bin/bg6py687nqv2mbe6e1hdtk57h/gradle-4.10/lib/gradle-launcher-4.10.jar:/root/.gradle/appengine-sdk/appengine-java-sdk-1.9.76/lib/appengine-tools-api.jar", "com.google.appengine.tools.development.DevAppServerMain", "--property=kickstart.user.dir=/app", "--no_java_agent", "--port=8080", "--address=localhost", "--allow_remote_shutdown", "/app/build/exploded-app"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
version: '3.7' | ||
|
||
services: | ||
wahlzeit: | ||
image: wahlzeit | ||
build: | ||
context: . | ||
ports: | ||
- "8080:8080" | ||
network_mode: host |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
FROM adoptopenjdk/openjdk8-openj9:alpine-slim as builder | ||
|
||
# Copy Gradle file | ||
COPY *.gradle /app/ | ||
|
||
# Copy sources | ||
COPY src /app/src | ||
|
||
# Copy Gradle resources | ||
COPY gradle /app/gradle | ||
COPY gradlew /app/gradlew | ||
|
||
WORKDIR /app | ||
|
||
# Test project | ||
RUN ./gradlew test | ||
|
||
# Expose port | ||
EXPOSE 8080 | ||
|
||
# Build & Run project (downloads Appengine SDK + builds + starts Dev Server) | ||
CMD ./gradlew appengineRun |