diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..32191a1 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,29 @@ +FROM openjdk:8u92-alpine + +ARG JAR_FILE +ARG CONF_FILE +ARG PROP_FILE +ARG MYSQL_CONNECTOR_VERSION=5.0.8 + +RUN apk add --update bash curl unzip && \ + rm -rf /var/cache/apk/* + +# Install MySQL Connector +WORKDIR /opt/holdmail/lib +RUN curl -sLO https://dev.mysql.com/get/Downloads/Connector-J/mysql-connector-java-${MYSQL_CONNECTOR_VERSION}.zip && \ + unzip mysql-connector-java-${MYSQL_CONNECTOR_VERSION}.zip + +# Install Holdmail + +RUN mkdir -p /var/log/holdmail + +WORKDIR /etc +ADD ${PROP_FILE} holdmail.properties + +WORKDIR /opt/holdmail/bin/ +ADD ${JAR_FILE} holdmail.jar +ADD ${CONF_FILE} holdmail.conf + +EXPOSE 8080 25000 + +ENTRYPOINT ["./holdmail.jar"] diff --git a/build.gradle b/build.gradle index 4d65464..a1c6d95 100644 --- a/build.gradle +++ b/build.gradle @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright 2016 - 2017 Sparta Systems, Inc + * Copyright 2016 - 2018 Sparta Systems, Inc * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -28,6 +28,7 @@ plugins { id "com.github.jk1.dependency-license-report" version "0.4.1" id "net.researchgate.release" version "2.5.0" id "com.jfrog.bintray" version "1.7.3" + id "com.palantir.docker" version "0.17.2" } @@ -37,6 +38,8 @@ description = 'holdmail' sourceCompatibility = '1.8' targetCompatibility = '1.8' +def dockerName = System.getProperty("dockerName", "sparta/holdmail") + dependencies { compile 'org.springframework.boot:spring-boot-starter-data-jpa' @@ -106,6 +109,7 @@ rat { 'README.md', 'CONTRIBUTING.md', 'RELEASE.md', + 'Dockerfile', '.github/*', 'docker/', 'src/main/resources/db/migration/*.sql', @@ -139,6 +143,12 @@ jar { from { ['LICENSE', 'NOTICE', "$projectDir/build/thirdparty-licenses"] } } +docker { + name dockerName + files jar.archivePath, './docker/assets/etc/holdmail.properties', './docker/assets/opt/holdmail/bin/holdmail.conf' + buildArgs(['JAR_FILE': "${jar.archiveName}", 'PROP_FILE': 'holdmail.properties', 'CONF_FILE':'holdmail.conf']) +} + def RPM_INSTALL_DIR = '/opt/holdmail' def RPM_USER = 'holdmail' def RPM_GROUP = 'holdmail' diff --git a/gradle.properties b/gradle.properties index 009791b..00140be 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,5 +1,5 @@ ################################################################################ -# Copyright 2016 Sparta Systems, Inc +# Copyright 2016 - 2018 Sparta Systems, Inc # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -17,5 +17,4 @@ ################################################################################ -version=1.0.5-SNAPSHOT - +version=2.0.0-SNAPSHOT \ No newline at end of file