瀏覽代碼

Use the built image in docker tests (#40314)

Instead of allowing docker-compose to rebuild it.
With this change we tag the image with a test label, and use that
in the testing as this is simpler that dealing with a dynamically
generated docker-compose file.
Alpar Torok 6 年之前
父節點
當前提交
03afb814c1
共有 2 個文件被更改,包括 9 次插入12 次删除
  1. 7 6
      distribution/docker/build.gradle
  2. 2 6
      distribution/docker/docker-compose.yml

+ 7 - 6
distribution/docker/build.gradle

@@ -90,10 +90,7 @@ void addCopyDockerfileTask(final boolean oss) {
 }
 
 preProcessFixture {
-  dependsOn taskName("copy", true, "DockerContext")
-  dependsOn taskName("copy", true, "Dockerfile")
-  dependsOn taskName("copy", false, "DockerContext")
-  dependsOn taskName("copy", false, "Dockerfile")
+  dependsOn assemble
 }
 
 postProcessFixture.doLast {
@@ -110,12 +107,16 @@ void addBuildDockerImage(final boolean oss) {
     dependsOn taskName("copy", oss, "Dockerfile")
     List<String> tags
     if (oss) {
-      tags = [ "docker.elastic.co/elasticsearch/elasticsearch-oss:${VersionProperties.elasticsearch}" ]
+      tags = [ 
+        "docker.elastic.co/elasticsearch/elasticsearch-oss:${VersionProperties.elasticsearch}",
+        "elasticsearch-oss:test" 
+      ]
     } else {
       tags = [
         "elasticsearch:${VersionProperties.elasticsearch}",
         "docker.elastic.co/elasticsearch/elasticsearch:${VersionProperties.elasticsearch}",
-        "docker.elastic.co/elasticsearch/elasticsearch-full:${VersionProperties.elasticsearch}"
+        "docker.elastic.co/elasticsearch/elasticsearch-full:${VersionProperties.elasticsearch}",
+        "elasticsearch:test",
       ]
     }
     executable 'docker'

+ 2 - 6
distribution/docker/docker-compose.yml

@@ -2,18 +2,14 @@
 version: '3'
 services:
   elasticsearch-default:
-    build:
-      context: ./build/docker
-      dockerfile: Dockerfile
+    image: elasticsearch:test
     environment:  
        - cluster.name=elasticsearch-default
        - discovery.type=single-node
     ports:
       - "9200"
   elasticsearch-oss:
-    build:
-      context: ./build/oss-docker
-      dockerfile: Dockerfile
+    image: elasticsearch-oss:test
     environment:  
        - cluster.name=elasticsearch-oss
        - discovery.type=single-node