Skip to content

Commit

Permalink
Merge pull request #107 from aabeling/master
Browse files Browse the repository at this point in the history
added another Dockerfile for the backend which allows external configuration
  • Loading branch information
Christoph-Meyer authored Jul 5, 2018
2 parents faedd92 + 41e39d5 commit 81548d7
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 0 deletions.
17 changes: 17 additions & 0 deletions sonarQuest-backend/Docker/Dockerfile2
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
FROM maven:3.5.3-jdk-8


LABEL maintainer="https://github.com/aabeling"
LABEL description="sonarquest backend with external configuration"

COPY . /usr/src/sonarQuest
WORKDIR /usr/src/sonarQuest

# build the executable jar
RUN mvn clean package

EXPOSE 8080
ENTRYPOINT java \
-jar \
-Dspring.config.location=/root/conf/application.properties \
target/sonarQuest-*.jar
36 changes: 36 additions & 0 deletions sonarQuest-backend/Docker/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Dockerfiles

Dockerfile2 is an alternative to the `Dockerfile` which is
used with docker-compose.

It allows an external configuration via an `application.properties`
lying on the docker host and which is made available to the
docker container via volumes.

Build the image e.g. from within the backend folder with

```
$ docker build -t sonarquest-backend -f Docker/Dockerfile2 .
```

The image expects the configuration files to be in folder `/root/conf/`.

Example setup with an external h2 file database:

let `sqb` be the current directory.
Define an `application.properties` in folder `sqb` with content

```
spring.datasource.url=jdbc:h2:file:/tmp/sonarQuest/sonarQuest
```

Start the container with

```
docker run -v `pwd`:/root/conf -v /tmp/sonarQuestDb:/tmp/sonarQuest sonarquest-backend
```

The h2 database file will then be created (or used) in the host's folder
`/tmp/sonarQuestDb`.


0 comments on commit 81548d7

Please sign in to comment.