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
  • Loading branch information
sergeytrasko committed Sep 26, 2017
1 parent 8f25018 commit e8012f4
Show file tree
Hide file tree
Showing 7 changed files with 71 additions and 5 deletions.
5 changes: 5 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.idea
*.iml
.git
build
cloud
12 changes: 12 additions & 0 deletions Dockerfile.dev
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
FROM gradle:4.1-jdk8

ENV HOME /home/gradle

RUN mkdir -p $HOME/app \
&& cd $HOME/app
WORKDIR $HOME/app

COPY .env .
COPY settings.gradle .

CMD ["gradle", "bootRun"]
12 changes: 12 additions & 0 deletions Dockerfile.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
FROM gradle:4.1-jdk8

ENV HOME /home/gradle

RUN mkdir -p $HOME/app \
&& cd $HOME/app
WORKDIR $HOME/app

COPY .env .
COPY settings.gradle .

CMD ["gradle", "clean", "test"]
21 changes: 18 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,12 @@ Spring Boot, GraphQL template project with batteries included.
 - Logging level, e.g. `LOGGING_LEVEL_feign=DEBUG`
- App properties, e.g. `APP_DEPENDENCY_API_HOST=example.com`
- See [Spring Boot documentation on relaxed property binding](https://docs.spring.io/spring-boot/docs/current/reference/html/boot-features-external-config.html#boot-features-external-config-relaxed-binding)
- Docker :whale: configuration for production deployment, development and test
- Remote debugging for development mode

## Required Software
- JDK 1.8
- Or docker + docker-compose

### Lombok

Expand All @@ -31,19 +34,29 @@ Spring Boot, GraphQL template project with batteries included.

## Develop

1. Create top level `.env` file and add required [key-values](https://docs.oracle.com/cd/E23095_01/Platform.93/ATGProgGuide/html/s0204propertiesfileformat01.html)
1. Create `.env` file

Create top level `.env` file and add required [key-values](https://docs.oracle.com/cd/E23095_01/Platform.93/ATGProgGuide/html/s0204propertiesfileformat01.html)

e.g.:
```
APP_ICNDB_URL=https://api.icndb.com
LOGGING_LEVEL_feign=DEBUG
```

2. `$ gradlew bootRun`
2.1. Run

- Gradle: `$ gradlew bootRun`
- Docker: `$ docker-compose up` (or `$ docker-compose up --build` if image should be rebuilt)

2.2. Debug

Run remote debugger from IDE. Debug port is 5005

## Test

`$ gradlew test`
- Gradle: `$ gradlew test`
- Docker: `$ docker-compose -f docker-compose.test.yml up --build`

## Build

Expand All @@ -56,6 +69,8 @@ LOGGING_LEVEL_feign=DEBUG
- [GraphQL](http://graphql.org/learn/) : API query runtime
- [GraphQL and GraphiQL Spring Framework Boot Starters](https://github.com/graphql-java/graphql-spring-boot)
- [GraphQL Java Tools](https://github.com/graphql-java/graphql-java-tools)
- Docker
- [Home Page](https://www.docker.com)

## Cloud Deployment

Expand Down
5 changes: 3 additions & 2 deletions api/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ buildscript {
ext {
springBootVersion = '1.5.4.RELEASE'
}

repositories {
mavenCentral()
}
Expand All @@ -15,7 +15,7 @@ buildscript {
repositories {
mavenCentral()
}

apply plugin: 'java'
sourceCompatibility = 1.8
targetCompatibility = 1.8
Expand All @@ -26,6 +26,7 @@ apply from: 'dotenv.gradle'

bootRun() {
environment << dotenv
jvmArgs = ['-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005']
}

dependencies {
Expand Down
9 changes: 9 additions & 0 deletions docker-compose.test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
version: "3"
services:
spring-boot-graphql-template-test:
build:
context: .
dockerfile: Dockerfile.test
volumes:
- $HOME/.gradle/caches:/home/gradle/.gradle/caches
- ${PWD}/api:/home/gradle/app/api
12 changes: 12 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
version: "3"
services:
spring-boot-graphql-template:
build:
context: .
dockerfile: Dockerfile.dev
volumes:
- $HOME/.gradle/caches:/home/gradle/.gradle/caches
- ${PWD}/api:/home/gradle/app/api
ports:
- "8080:8080"
- "5005:5005"

0 comments on commit e8012f4

Please sign in to comment.