diff --git a/docker/demo/Dockerfile b/docker/demo/Dockerfile index ec3c67fe..9d88204f 100644 --- a/docker/demo/Dockerfile +++ b/docker/demo/Dockerfile @@ -3,7 +3,9 @@ FROM alpine/git ARG GIT_TAG WORKDIR /demo -RUN git clone -b "$GIT_TAG" --depth 1 https://github.com/SafeExamBrowser/seb-server.git +RUN if [ "x$arg" = "x" ] ; \ + then git clone --depth 1 https://github.com/SafeExamBrowser/seb-server.git ; \ + else git clone -b "$GIT_TAG" --depth 1 https://github.com/SafeExamBrowser/seb-server.git ; fi FROM maven:3.5-jdk-8-alpine @@ -16,13 +18,20 @@ RUN mvn clean install -e -P Demo -DskipTests FROM openjdk:8-jre-alpine ARG SEBSERVER_VERSION -ENV SEBSERVER_VERSION ${SEBSERVER_VERSION} +ENV SEBSERVER_VERSION=${SEBSERVER_VERSION} +ENV SERVER_ADDRESS=0.0.0.0 +ENV SERVER_PORT=8080 +ENV DBSERVER_ADDRESS=seb-server-mariadb +ENV DBSERVER_PORT=3306 +ENV DBSERVER_PWD= +ENV GUICLIENT_PWD= +ENV INTERNAL_PWD= WORKDIR /demo COPY --from=1 /demo/target/seb-server-"$SEBSERVER_VERSION".jar /demo ENTRYPOINT ["sh", "-c"] -CMD ["java -jar seb-server-${SEBSERVER_VERSION}.jar --spring.config.location=classpath:/config/,file:/demo/externalResources/ --server.address=0.0.0.0 --spring.profiles.active=demo"] +CMD ["java -jar seb-server-${SEBSERVER_VERSION}.jar --server.address=${SERVER_ADDRESS} --server.port=${SERVER_PORT} --spring.config.location=classpath:/config/,file:/demo/externalResources/ --datastore.mariadb.server.address=${DBSERVER_ADDRESS} --datastore.mariadb.server.port${DBSERVER_PORT} --spring.profiles.active=demo --spring.datasource.password=${DBSERVER_PWD} --sebserver.webservice.api.admin.clientSecret={GUICLIENT_PWD} --sebserver.webservice.internalSecret=${INTERNAL_PWD}"] EXPOSE 8080 \ No newline at end of file diff --git a/docker/demo/docker-compose.yml b/docker/demo/docker-compose.yml new file mode 100644 index 00000000..fa6c409a --- /dev/null +++ b/docker/demo/docker-compose.yml @@ -0,0 +1,41 @@ +version: '3' +services: + mariadb: + image: "mariadb/server:10.3" + container_name: seb-server-mariadb + volumes: + - seb-server-mariadb-data:/var/lib/mysql + environment: + - MYSQL_ROOT_PASSWORD=[TO SET] + ports: + - 3306:3306 + networks: + - ralph + + seb-server: + build: + context: . + args: + - GIT_TAG= + - SEBSERVER_VERSION=0.4.0-SNAPSHOT + container_name: seb-server + environment: + - SERVER_ADDRESS=0.0.0.0 + - SERVER_PORT=8080 + - DBSERVER_ADDRESS=seb-server-mariadb + - DBSERVER_PORT=3306 + - ENV DBSERVER_PWD=[TO SET] + - ENV GUICLIENT_PWD=[TO SET] + - ENV INTERNAL_PWD=[TO SET] + ports: + - 8080:8080 + networks: + - ralph + depends_on: + - "mariadb" + +networks: + ralph: + +volumes: + seb-server-mariadb-data: \ No newline at end of file diff --git a/docker/prod/standalone/selfsigned/Dockerfile b/docker/prod/standalone/selfsigned/Dockerfile index f51d38b4..fe955773 100644 --- a/docker/prod/standalone/selfsigned/Dockerfile +++ b/docker/prod/standalone/selfsigned/Dockerfile @@ -24,25 +24,29 @@ ARG SEBSERVER_VERSION WORKDIR /sebserver COPY --from=1 /sebserver/target/seb-server-"$SEBSERVER_VERSION".jar /sebserver -ENTRYPOINT ["sh", "-c"] - +ARG SEBSERVER_VERSION +ENV SEBSERVER_VERSION=${SEBSERVER_VERSION} ENV SERVER_ADDRESS=0.0.0.0 ENV SERVER_PORT=80 ENV DBSERVER_ADDRESS=localhost ENV DBSERVER_PORT=3306 ENV KEYSTORE_PWD= -CMD java \ - -Dfile.encoding=UTF-8 \ - -Djavax.net.ssl.keyStore=seb-server-keystore.pkcs12 \ - -Djavax.net.ssl.keyStorePassword="${KEYSTORE_PWD}" \ - -Djavax.net.ssl.trustStore=seb-server-truststore.pkcs12 \ - -Djavax.net.ssl.trustStorePassword="${KEYSTORE_PWD}" \ - -jar seb-server-"${SEBSERVER_VERSION}".jar \ - --spring.config.location=classpath:/config/,file:/sebserver/ \ - --server.address="${SERVER_ADDRESS}" \ - --spring.profiles.active=dev \ - --datastore.mariadb.server.address="${DBSERVER_ADDRESS}" \ - --datastore.mariadb.server.port="${DBSERVER_PORT}" +ENTRYPOINT ["sh", "-c"] + +CMD ["java -jar seb-server-${SEBSERVER_VERSION}.jar --spring.config.location=classpath:/config/,file:/sebserver/ --server.address=${SERVER_ADDRESS} --spring.profiles.active=dev"] + +# CMD java \ +# -Dfile.encoding=UTF-8 \ +# -Djavax.net.ssl.keyStore=seb-server-keystore.pkcs12 \ +# -Djavax.net.ssl.keyStorePassword="${KEYSTORE_PWD}" \ +# -Djavax.net.ssl.trustStore=seb-server-truststore.pkcs12 \ +# -Djavax.net.ssl.trustStorePassword="${KEYSTORE_PWD}" \ +# -jar seb-server-"${SEBSERVER_VERSION}".jar \ +# --spring.config.location=classpath:/config/,file:/sebserver/ \ +# --server.address="${SERVER_ADDRESS}" \ +# --spring.profiles.active=dev \ +# --datastore.mariadb.server.address="${DBSERVER_ADDRESS}" \ +# --datastore.mariadb.server.port="${DBSERVER_PORT}" EXPOSE $PORT \ No newline at end of file diff --git a/docker/prod/standalone/selfsigned/docker-compose.yml b/docker/prod/standalone/selfsigned/docker-compose.yml index 3a9010da..3d36aa49 100644 --- a/docker/prod/standalone/selfsigned/docker-compose.yml +++ b/docker/prod/standalone/selfsigned/docker-compose.yml @@ -18,7 +18,7 @@ services: - ./certs:/etc/mysql/certs - seb-server-mariadb-data:/var/lib/mysql environment: - - MYSQL_ROOT_PASSWORD=[TO SET] + - MYSQL_ROOT_PASSWORD=somePW ports: - 3306:3306 networks: @@ -34,11 +34,11 @@ services: - SEBSERVER_VERSION=0.4.0-SNAPSHOT container_name: seb-server environment: - - SERVER_ADDRESS - - SERVER_PORT - - DBSERVER_ADDRESS - - DBSERVER_PORT - - KEYSTORE_PWD=[TO SET] + - SERVER_ADDRESS=0.0.0.0 + - SERVER_PORT=80 + - DBSERVER_ADDRESS=localhost + - DBSERVER_PORT=3306 + - KEYSTORE_PWD=somePW ports: - 80:80 networks: diff --git a/src/main/resources/config/application-demo.properties b/src/main/resources/config/application-demo.properties index 74914f2c..42109f7c 100644 --- a/src/main/resources/config/application-demo.properties +++ b/src/main/resources/config/application-demo.properties @@ -10,6 +10,7 @@ datastore.mariadb.server.address=seb-server-mariadb datastore.mariadb.server.port=3306 # data source configuration +spring.datasource.username=root spring.datasource.initialize=true spring.datasource.initialization-mode=always spring.datasource.url=jdbc:mariadb://${datastore.mariadb.server.address}:${datastore.mariadb.server.port}/SEBServer?useSSL=false&createDatabaseIfNotExist=true