Build both corretto and zulu docker images (#4359)

* add logic to push images

* build zulu and corretto images
This commit is contained in:
Stefano Franz 2018-12-06 03:42:07 -08:00 committed by GitHub
parent d2d13c1dfc
commit b641a08a7f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 99 additions and 12 deletions

View File

@ -55,6 +55,7 @@ task buildDockerFolder(dependsOn: [":node:capsule:buildCordaJAR", shadowJar]) {
from shadowJar.archivePath
from "src/config/starting-node.conf"
from "src/bash/generate-config.sh"
from "src/docker/DockerfileAL"
from "src/docker/Dockerfile"
rename(cordaJar.name, "corda.jar")
rename(shadowJar.archivePath.name, "config-exporter.jar")
@ -64,23 +65,35 @@ task buildDockerFolder(dependsOn: [":node:capsule:buildCordaJAR", shadowJar]) {
final String runTime = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss"))
final String suffix = project.version.toString().toLowerCase().contains("snapshot") ? runTime : "RELEASE"
final buildTags = ["corda/corda-${project.version.toString().toLowerCase()}:${suffix}", "corda/corda-${project.version.toString().toLowerCase()}:latest"]
final zuluBuildTags = ["corda/corda-zulu-${project.version.toString().toLowerCase()}:${suffix}", "corda/corda-zulu-${project.version.toString().toLowerCase()}:latest"]
final correttoBuildTags = ["corda/corda-corretto-${project.version.toString().toLowerCase()}:${suffix}", "corda/corda-corretto-${project.version.toString().toLowerCase()}:latest"]
task buildOfficialDockerImage(type: DockerBuildImage, dependsOn: [buildDockerFolder]) {
//if we are a snapshot, append a timestamp
//if we are a release, append RELEASE
task buildOfficialZuluDockerImage(type: DockerBuildImage, dependsOn: [buildDockerFolder]) {
inputDir = new File(project.buildDir, "docker-temp")
tags = buildTags
tags = zuluBuildTags
dockerFile = new File(new File(project.buildDir, "docker-temp"), "Dockerfile")
}
task pushTimeStampedTag('type': DockerPushImage, dependsOn: [buildOfficialDockerImage]){
imageName = buildTags[0]
task buildOfficialCorrettoDockerImage(type: DockerBuildImage, dependsOn: [buildDockerFolder]) {
inputDir = new File(project.buildDir, "docker-temp")
tags = correttoBuildTags
dockerFile = new File(new File(project.buildDir, "docker-temp"), "DockerfileAL")
}
task pushLatestTag('type': DockerPushImage, dependsOn: [buildOfficialDockerImage]){
imageName = buildTags[1]
task pushZuluTimeStampedTag('type': DockerPushImage, dependsOn: [buildOfficialZuluDockerImage]){
imageName = zuluBuildTags[0]
}
task pushOfficialImages(dependsOn: [pushTimeStampedTag, pushLatestTag]){
}
task pushZuluLatestTag('type': DockerPushImage, dependsOn: [buildOfficialZuluDockerImage]){
imageName = zuluBuildTags[1]
}
task pushCorrettoTimeStampedTag('type': DockerPushImage, dependsOn: [buildOfficialCorrettoDockerImage]){
imageName = correttoBuildTags[0]
}
task pushCorrettoLatestTag('type': DockerPushImage, dependsOn: [buildOfficialCorrettoDockerImage]){
imageName = correttoBuildTags[1]
}
task pushOfficialImages(dependsOn: [pushZuluTimeStampedTag, pushZuluLatestTag, pushCorrettoTimeStampedTag, pushCorrettoLatestTag])

View File

@ -0,0 +1,74 @@
FROM amazonlinux:2
RUN amazon-linux-extras enable corretto8
RUN yum -y install java-1.8.0-amazon-corretto-devel
RUN yum -y install bash
RUN yum -y install curl
RUN yum -y install unzip
# Create dirs
RUN mkdir -p /opt/corda/cordapps
RUN mkdir -p /opt/corda/persistence
RUN mkdir -p /opt/corda/certificates
RUN mkdir -p /opt/corda/drivers
RUN mkdir -p /opt/corda/logs
RUN mkdir -p /opt/corda/bin
RUN mkdir -p /opt/corda/additional-node-infos
RUN mkdir -p /etc/corda
# Create corda user
RUN groupadd corda && \
useradd corda -g corda -m -d /opt/corda
WORKDIR /opt/corda
ENV CORDAPPS_FOLDER="/opt/corda/cordapps"
ENV PERSISTENCE_FOLDER="/opt/corda/persistence"
ENV CERTIFICATES_FOLDER="/opt/corda/certificates"
ENV DRIVERS_FOLDER="/opt/corda/drivers"
ENV CONFIG_FOLDER="/etc/corda"
ENV MY_P2P_PORT=10200
ENV MY_RPC_PORT=10201
ENV MY_RPC_ADMIN_PORT=10202
RUN chown -R corda:corda /opt/corda
RUN chown -R corda:corda /etc/corda
##CORDAPPS FOLDER
VOLUME ["/opt/corda/cordapps"]
##PERSISTENCE FOLDER
VOLUME ["/opt/corda/persistence"]
##CERTS FOLDER
VOLUME ["/opt/corda/certificates"]
##OPTIONAL JDBC DRIVERS FOLDER
VOLUME ["/opt/corda/drivers"]
##LOG FOLDER
VOLUME ["/opt/corda/logs"]
##ADDITIONAL NODE INFOS FOLDER
VOLUME ["/opt/corda/additional-node-infos"]
##CONFIG LOCATION
VOLUME ["/etc/corda"]
##CORDA JAR
ADD --chown=corda:corda corda.jar /opt/corda/bin/corda.jar
##CONFIG MANIPULATOR JAR
ADD --chown=corda:corda config-exporter.jar /opt/corda/config-exporter.jar
##CONFIG GENERATOR SHELL SCRIPT
ADD --chown=corda:corda generate-config.sh /opt/corda/bin/config-generator
##CORDA RUN SCRIPT
ADD --chown=corda:corda run-corda.sh /opt/corda/bin/run-corda
##BASE CONFIG FOR GENERATOR
ADD --chown=corda:corda starting-node.conf /opt/corda/starting-node.conf
##SET EXECUTABLE PERMISSIONS
RUN chmod +x /opt/corda/bin/config-generator
RUN chmod +x /opt/corda/bin/run-corda
ENV PATH=$PATH:/opt/corda/bin
EXPOSE $MY_P2P_PORT
EXPOSE $MY_RPC_PORT
USER "corda"
CMD ["run-corda"]