diff --git a/Dockerfile b/Dockerfile index bbb51f6d69d32897b6dcad7df6b4a2f5481d1825..b1bf8af859266de4d8fefa9309a98ec4b2c3d3af 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,4 +4,6 @@ COPY target/mip.jar /opt/mip/mip.jar EXPOSE 8080 -CMD ["/usr/bin/java", "-jar", "/opt/mip/mip.jar"] +VOLUME /opt/portal/config/ + +CMD ["/usr/bin/java", "-DconfigFile=/opt/portal/config/portal.properties", -jar", "/opt/mip/mip.jar"] diff --git a/after-git-clone.sh b/after-git-clone.sh new file mode 100755 index 0000000000000000000000000000000000000000..423f04205dc182d5ab78d9e1e32bc8a3c0f88635 --- /dev/null +++ b/after-git-clone.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +git submodule update --init diff --git a/after-update.sh b/after-update.sh new file mode 100755 index 0000000000000000000000000000000000000000..c70bd5d6716f6d10e03a1d446958b58ea2ee7a6b --- /dev/null +++ b/after-update.sh @@ -0,0 +1,5 @@ +#!/bin/sh + +git submodule sync +git submodule update --init +git submodule foreach git pull origin master diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000000000000000000000000000000000000..57c61b522916a229202d9c4455468a4f6a1c3ab1 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,18 @@ + +portaldb: + image: postgres:9.4.5 + ports: + - "55432:5432" + volumes: + - ./src/test/db/sql:/docker-entrypoint-initdb.d/ + environment: + POSTGRES_PASSWORD: test + +portal-backend: + build: . + volumes: + - ./src/test/docker/:/opt/portal/config/ + links: + - portaldb + ports: + - "8080:8080" diff --git a/run.sh b/run.sh index 2d937921eba8f9e462fcd7a6d8f76590b5ca99f4..13c4f109ab2583c34c067a18ab97f064534c9e9b 100755 --- a/run.sh +++ b/run.sh @@ -1,9 +1,9 @@ #!/bin/bash -e if groups $USER | grep &>/dev/null '\bdocker\b'; then - DOCKER="docker" + DOCKER_COMPOSE="docker-compose" else - DOCKER="sudo docker" + DOCKER_COMPOSE="sudo docker-compose" fi -$DOCKER run -p 8080:8080 -d portal-backend +$DOCKER_COMPOSE up diff --git a/src/main/resources/hibernate.cfg.xml b/src/main/resources/hibernate.cfg.xml index e2960eb76e5b19cb0f853843c54ff8e12f76f3eb..798fb189cffa8dc068c49ec615b9b170b9aad6ae 100644 --- a/src/main/resources/hibernate.cfg.xml +++ b/src/main/resources/hibernate.cfg.xml @@ -6,9 +6,9 @@ <hibernate-configuration> <session-factory> <property name="connection.driver_class">org.postgresql.Driver</property> - <property name="connection.url">jdbc:postgresql://localhost:5432/mirco</property> - <property name="connection.username">mirco</property> - <property name="connection.password">pass</property> + <property name="connection.url">jdbc:postgresql://portaldb:5432/postgres</property> + <property name="connection.username">postgres</property> + <property name="connection.password">test</property> <property name="hibernate.format_sql">true</property> <property name="connection.pool_size">1</property> <property name="hibernate.dialect">org.hibernate.dialect.PostgreSQL82Dialect</property> diff --git a/src/test/db b/src/test/db index d1aec18356813ac3da729d8a938299b41e0251ee..94643e89555c876e5286933f8216f67c9bc559be 160000 --- a/src/test/db +++ b/src/test/db @@ -1 +1 @@ -Subproject commit d1aec18356813ac3da729d8a938299b41e0251ee +Subproject commit 94643e89555c876e5286933f8216f67c9bc559be diff --git a/src/test/docker/portal.properties b/src/test/docker/portal.properties new file mode 100644 index 0000000000000000000000000000000000000000..dc4de9ec3046957eefb073035d527063fdfda74b --- /dev/null +++ b/src/test/docker/portal.properties @@ -0,0 +1,7 @@ +# Configuration for the portal running inside a Docker container for development + +connection.url="jdbc:postgresql://portaldb:5432/postgres" +connection.username="postgres" +connection.password="test" + +security.enabled=false