-
Notifications
You must be signed in to change notification settings - Fork 29
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 #107 from aabeling/master
added another Dockerfile for the backend which allows external configuration
- Loading branch information
Showing
2 changed files
with
53 additions
and
0 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,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 |
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,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`. | ||
|
||
|