Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable Dockerfile from artifacts.elastic.co #38552

Merged
merged 6 commits into from
Feb 8, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 22 additions & 8 deletions distribution/docker/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,29 @@ dependencies {
}

ext.expansions = { oss ->
String classifier = 'linux-x86_64'
final String classifier = 'linux-x86_64'
final String elasticsearch = oss ? "elasticsearch-oss-${VersionProperties.elasticsearch}-${classifier}.tar.gz" : "elasticsearch-${VersionProperties.elasticsearch}-${classifier}.tar.gz"
return [
'elasticsearch' : oss ? "elasticsearch-oss-${VersionProperties.elasticsearch}-${classifier}.tar.gz" : "elasticsearch-${VersionProperties.elasticsearch}-${classifier}.tar.gz",
'jdkUrl' : 'https://download.java.net/java/GA/jdk11/9/GPL/openjdk-11.0.2_linux-x64_bin.tar.gz',
'jdkVersion' : '11.0.2',
'license': oss ? 'Apache-2.0' : 'Elastic License',
'version' : VersionProperties.elasticsearch
'elasticsearch' : elasticsearch,
'jdkUrl' : 'https://download.java.net/java/GA/jdk11/9/GPL/openjdk-11.0.2_linux-x64_bin.tar.gz',
'jdkVersion' : '11.0.2',
'license' : oss ? 'Apache-2.0' : 'Elastic License',
'source_elasticsearch': local() ? "COPY $elasticsearch /opt" : "RUN curl --retry 8 -s -L -O https://artifacts.elastic.co/downloads/elasticsearch/${elasticsearch}",
'version' : VersionProperties.elasticsearch
]
}

private static boolean local() {
final String buildDockerSource = System.getProperty("build.docker.source")
if (buildDockerSource == null || "local".equals(buildDockerSource)) {
return true
} else if ("remote".equals(buildDockerSource)) {
return false
} else {
throw new IllegalArgumentException("expected build.docker.source to be [local] or [remote] but was [" + buildDockerSource + "]")
}
}

private static String files(final boolean oss) {
return "build/${ oss ? 'oss-' : ''}docker"
}
Expand Down Expand Up @@ -61,7 +74,9 @@ void addCopyDockerContextTask(final boolean oss) {
void addCopyDockerfileTask(final boolean oss) {
task(taskName("copy", oss, "Dockerfile"), type: Copy) {
inputs.properties(expansions(oss)) // ensure task is run when ext.expansions is changed
mustRunAfter(taskName("copy", oss, "DockerContext"))
if (local()) {
mustRunAfter(taskName("copy", oss, "DockerContext"))
}
into files(oss)

from('src/docker/Dockerfile') {
Expand All @@ -70,7 +85,6 @@ void addCopyDockerfileTask(final boolean oss) {
}
}


preProcessFixture {
dependsOn taskName("copy", true, "DockerContext")
dependsOn taskName("copy", true, "Dockerfile")
Expand Down
4 changes: 2 additions & 2 deletions distribution/docker/src/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@ RUN groupadd -g 1000 elasticsearch && \

WORKDIR /usr/share/elasticsearch

COPY ${elasticsearch} /opt/
${source_elasticsearch}

RUN tar zxf /opt/${elasticsearch} --strip-components=1
RUN mkdir -p config data logs
RUN chmod 0775 config data logs
COPY config/elasticsearch.yml config/log4j2.properties config/


################################################################################
# Build stage 1 (the actual elasticsearch image):
# Copy elasticsearch from stage 0
Expand Down