You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2018/02/26 20:43:20 UTC

[GitHub] merlimat closed pull request #1284: Mavenize docker images

merlimat closed pull request #1284: Mavenize docker images
URL: https://github.com/apache/incubator-pulsar/pull/1284
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/all/pom.xml b/all/pom.xml
index deddfacdf..401943c29 100644
--- a/all/pom.xml
+++ b/all/pom.xml
@@ -108,7 +108,7 @@
               <goal>single</goal>
             </goals>
             <configuration>
-              <attach>false</attach>
+              <attach>true</attach>
               <tarLongFileMode>posix</tarLongFileMode>
               <finalName>apache-pulsar-${project.version}</finalName>
               <descriptors>
@@ -119,6 +119,13 @@
           </execution>
         </executions>
       </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-deploy-plugin</artifactId>
+        <configuration>
+          <skip>true</skip>
+        </configuration>
+      </plugin>
     </plugins>
   </build>
 </project>
diff --git a/dashboard/pom.xml b/dashboard/pom.xml
new file mode 100644
index 000000000..78734c359
--- /dev/null
+++ b/dashboard/pom.xml
@@ -0,0 +1,93 @@
+<!--
+
+    Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF licenses this file
+    to you under the Apache License, Version 2.0 (the
+    "License"); you may not use this file except in compliance
+    with the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing,
+    software distributed under the License is distributed on an
+    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+    KIND, either express or implied.  See the License for the
+    specific language governing permissions and limitations
+    under the License.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+  <parent>
+    <groupId>org.apache.pulsar</groupId>
+    <artifactId>docker-images</artifactId>
+    <version>2.0.0-incubating-SNAPSHOT</version>
+    <relativePath>../docker</relativePath>
+  </parent>
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>org.apache.pulsar</groupId>
+  <artifactId>dashboard-docker-image</artifactId>
+  <name>Apache Pulsar :: Docker Images :: Pulsar Dashboard</name>
+  <packaging>pom</packaging>
+
+  <profiles>
+    <profile>
+      <id>docker</id>
+      <build>
+        <plugins>
+          <plugin>
+            <groupId>com.spotify</groupId>
+            <artifactId>dockerfile-maven-plugin</artifactId>
+            <version>${dockerfile-maven.version}</version>
+            <executions>
+              <execution>
+                <id>default</id>
+                <goals>
+                  <goal>build</goal>
+                </goals>
+              </execution>
+              <execution>
+                <id>add-no-repo-tag-and-version</id>
+                <goals>
+                  <goal>tag</goal>
+                </goals>
+                <configuration>
+                  <repository>pulsar-dashboard</repository>
+                  <tag>${project.version}</tag>
+                </configuration>
+              </execution>
+              <execution>
+                <id>add-no-repo-tag-and-latest</id>
+                <goals>
+                  <goal>tag</goal>
+                </goals>
+                <configuration>
+                  <repository>pulsar-dashboard</repository>
+                  <tag>latest</tag>
+                </configuration>
+              </execution>
+              <execution>
+                <id>tag-and-push-latest</id>
+                <goals>
+                  <goal>tag</goal>
+                  <goal>push</goal>
+                </goals>
+                <configuration>
+                  <repository>${docker.organization}/pulsar-dashboard</repository>
+                  <tag>latest</tag>
+                </configuration>
+              </execution>
+            </executions>
+            <configuration>
+              <repository>${docker.organization}/pulsar-dashboard</repository>
+              <tag>${project.version}</tag>
+              <pullNewerImage>false</pullNewerImage>
+            </configuration>
+          </plugin>
+        </plugins>
+      </build>
+    </profile>
+  </profiles>
+</project>
diff --git a/docker/build.sh b/docker/build.sh
index eb707a247..0c35171f7 100755
--- a/docker/build.sh
+++ b/docker/build.sh
@@ -21,44 +21,6 @@
 ROOT_DIR=$(git rev-parse --show-toplevel)
 cd $ROOT_DIR/docker
 
-MVN_VERSION=`./get-version.sh`
+mvn package -Pdocker
+mvn -f ../dashboard/pom.xml package -Pdocker
 
-echo "Pulsar version: ${MVN_VERSION}"
-
-PULSAR_TGZ=$(dirname $PWD)/all/target/apache-pulsar-${MVN_VERSION}-bin.tar.gz
-
-if [ ! -f $PULSAR_TGZ ]; then
-    echo "Pulsar bin distribution not found at ${PULSAR_TGZ}"
-    exit 1
-fi
-
-LINKED_PULSAR_TGZ=apache-pulsar-${MVN_VERSION}-bin.tar.gz
-ln -f ${PULSAR_TGZ} $LINKED_PULSAR_TGZ
-
-echo "Using Pulsar binary package at ${PULSAR_TGZ}"
-
-# Build base image, reused by all other components
-docker build --build-arg VERSION=${MVN_VERSION} \
-             -t pulsar:latest .
-
-if [ $? != 0 ]; then
-    echo "Error: Failed to create Docker image for pulsar"
-    exit 1
-fi
-
-rm apache-pulsar-${MVN_VERSION}-bin.tar.gz
-
-
-# Build pulsar-grafana image
-docker build -t pulsar-grafana:latest grafana
-if [ $? != 0 ]; then
-    echo "Error: Failed to create Docker image for pulsar-grafana"
-    exit 1
-fi
-
-# Build dashboard docker image
-docker build -t pulsar-dashboard:latest ../dashboard
-if [ $? != 0 ]; then
-    echo "Error: Failed to create Docker image for pulsar-dashboard"
-    exit 1
-fi
diff --git a/docker/grafana/pom.xml b/docker/grafana/pom.xml
new file mode 100644
index 000000000..450eb827d
--- /dev/null
+++ b/docker/grafana/pom.xml
@@ -0,0 +1,92 @@
+<!--
+
+    Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF licenses this file
+    to you under the Apache License, Version 2.0 (the
+    "License"); you may not use this file except in compliance
+    with the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing,
+    software distributed under the License is distributed on an
+    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+    KIND, either express or implied.  See the License for the
+    specific language governing permissions and limitations
+    under the License.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+  <parent>
+    <groupId>org.apache.pulsar</groupId>
+    <artifactId>docker-images</artifactId>
+    <version>2.0.0-incubating-SNAPSHOT</version>
+  </parent>
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>org.apache.pulsar</groupId>
+  <artifactId>grafana-docker-image</artifactId>
+  <name>Apache Pulsar :: Docker Images :: Grafana</name>
+  <packaging>pom</packaging>
+
+  <profiles>
+    <profile>
+      <id>docker</id>
+      <build>
+        <plugins>
+          <plugin>
+            <groupId>com.spotify</groupId>
+            <artifactId>dockerfile-maven-plugin</artifactId>
+            <version>${dockerfile-maven.version}</version>
+            <executions>
+              <execution>
+                <id>default</id>
+                <goals>
+                  <goal>build</goal>
+                </goals>
+              </execution>
+              <execution>
+                <id>add-no-repo-and-version</id>
+                <goals>
+                  <goal>tag</goal>
+                </goals>
+                <configuration>
+                  <repository>pulsar-grafana</repository>
+                  <tag>${project.version}</tag>
+                </configuration>
+              </execution>
+              <execution>
+                <id>add-no-repo-and-latest</id>
+                <goals>
+                  <goal>tag</goal>
+                </goals>
+                <configuration>
+                  <repository>pulsar-grafana</repository>
+                  <tag>latest</tag>
+                </configuration>
+              </execution>
+              <execution>
+                <id>tag-and-push-latest</id>
+                <goals>
+                  <goal>tag</goal>
+                  <goal>push</goal>
+                </goals>
+                <configuration>
+                  <repository>${docker.organization}/pulsar-grafana</repository>
+                  <tag>latest</tag>
+                </configuration>
+              </execution>
+            </executions>
+            <configuration>
+              <repository>${docker.organization}/pulsar-grafana</repository>
+              <tag>${project.version}</tag>
+              <pullNewerImage>false</pullNewerImage>
+            </configuration>
+          </plugin>
+        </plugins>
+      </build>
+    </profile>
+  </profiles>
+</project>
diff --git a/docker/pom.xml b/docker/pom.xml
new file mode 100644
index 000000000..2693bf766
--- /dev/null
+++ b/docker/pom.xml
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF licenses this file
+    to you under the Apache License, Version 2.0 (the
+    "License"); you may not use this file except in compliance
+    with the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing,
+    software distributed under the License is distributed on an
+    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+    KIND, either express or implied.  See the License for the
+    specific language governing permissions and limitations
+    under the License.
+
+-->
+<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+  <packaging>pom</packaging>
+  <modelVersion>4.0.0</modelVersion>
+  <parent>
+    <groupId>org.apache.pulsar</groupId>
+    <artifactId>pulsar</artifactId>
+    <version>2.0.0-incubating-SNAPSHOT</version>
+  </parent>
+  <groupId>org.apache.pulsar</groupId>
+  <artifactId>docker-images</artifactId>
+  <name>Apache Pulsar :: Docker Images</name>
+  <properties>
+    <dockerfile-maven.version>1.3.7</dockerfile-maven.version>
+    <docker.organization>apachepulsar</docker.organization>
+  </properties>
+  <modules>
+    <module>pulsar</module>
+    <module>grafana</module>
+  </modules>
+</project>
diff --git a/docker/Dockerfile b/docker/pulsar/Dockerfile
similarity index 92%
rename from docker/Dockerfile
rename to docker/pulsar/Dockerfile
index f9e6cd7a5..395f5a330 100644
--- a/docker/Dockerfile
+++ b/docker/pulsar/Dockerfile
@@ -22,10 +22,10 @@ FROM openjdk:8-jdk
 # Install some utilities
 RUN apt-get update && apt-get install -y netcat dnsutils
 
-ARG VERSION
+ARG PULSAR_TARBALL
 
-ADD apache-pulsar-${VERSION}-bin.tar.gz /
-RUN mv /apache-pulsar-${VERSION} /pulsar
+ADD ${PULSAR_TARBALL} /
+RUN mv /apache-pulsar-* /pulsar
 
 COPY scripts/apply-config-from-env.py /pulsar/bin
 COPY scripts/generate-zookeeper-config.sh /pulsar/bin
diff --git a/docker/pulsar/pom.xml b/docker/pulsar/pom.xml
new file mode 100644
index 000000000..63c42ca3d
--- /dev/null
+++ b/docker/pulsar/pom.xml
@@ -0,0 +1,124 @@
+<!--
+
+    Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF licenses this file
+    to you under the Apache License, Version 2.0 (the
+    "License"); you may not use this file except in compliance
+    with the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing,
+    software distributed under the License is distributed on an
+    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+    KIND, either express or implied.  See the License for the
+    specific language governing permissions and limitations
+    under the License.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+  <parent>
+    <groupId>org.apache.pulsar</groupId>
+    <artifactId>docker-images</artifactId>
+    <version>2.0.0-incubating-SNAPSHOT</version>
+  </parent>
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>org.apache.pulsar</groupId>
+  <artifactId>pulsar-docker-image</artifactId>
+  <name>Apache Pulsar :: Docker Images :: Pulsar Latest Version</name>
+  <packaging>pom</packaging>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.pulsar</groupId>
+      <artifactId>distribution</artifactId>
+      <version>${project.parent.version}</version>
+      <classifier>bin</classifier>
+      <type>tar.gz</type>
+      <scope>provided</scope>
+    </dependency>
+  </dependencies>
+
+  <profiles>
+    <profile>
+      <id>docker</id>
+      <build>
+        <plugins>
+          <plugin>
+            <groupId>com.spotify</groupId>
+            <artifactId>dockerfile-maven-plugin</artifactId>
+            <version>${dockerfile-maven.version}</version>
+            <executions>
+              <execution>
+                <id>default</id>
+                <goals>
+                  <goal>build</goal>
+                </goals>
+              </execution>
+              <execution>
+                <id>add-no-repo-and-version</id>
+                <goals>
+                  <goal>tag</goal>
+                </goals>
+                <configuration>
+                  <repository>pulsar</repository>
+                  <tag>${project.version}</tag>
+                </configuration>
+              </execution>
+              <execution>
+                <id>add-no-repo-and-latest</id>
+                <goals>
+                  <goal>tag</goal>
+                </goals>
+                <configuration>
+                  <repository>pulsar</repository>
+                  <tag>latest</tag>
+                </configuration>
+              </execution>
+              <execution>
+                <id>tag-and-push-latest</id>
+                <goals>
+                  <goal>tag</goal>
+                  <goal>push</goal>
+                </goals>
+                <configuration>
+                  <repository>${docker.organization}/pulsar</repository>
+                  <tag>latest</tag>
+                </configuration>
+              </execution>
+            </executions>
+            <configuration>
+              <repository>${docker.organization}/pulsar</repository>
+              <pullNewerImage>false</pullNewerImage>
+              <tag>${project.version}</tag>
+              <buildArgs>
+                <PULSAR_TARBALL>target/distribution-${project.version}-bin.tar.gz</PULSAR_TARBALL>
+              </buildArgs>
+            </configuration>
+          </plugin>
+          <plugin>
+            <groupId>org.apache.maven.plugins</groupId>
+            <artifactId>maven-dependency-plugin</artifactId>
+            <executions>
+              <execution>
+                <id>copy-tarball</id>
+                <goals>
+                  <goal>copy-dependencies</goal>
+                </goals>
+                <phase>generate-resources</phase>
+                <configuration>
+                  <outputDirectory>${project.build.directory}/</outputDirectory>
+                  <includeArtifactIds>distribution</includeArtifactIds>
+                  <excludeTransitive>true</excludeTransitive>
+                </configuration>
+              </execution>
+            </executions>
+          </plugin>
+        </plugins>
+      </build>
+    </profile>
+  </profiles>
+</project>
diff --git a/docker/scripts/apply-config-from-env.py b/docker/pulsar/scripts/apply-config-from-env.py
similarity index 100%
rename from docker/scripts/apply-config-from-env.py
rename to docker/pulsar/scripts/apply-config-from-env.py
diff --git a/docker/scripts/generate-zookeeper-config.sh b/docker/pulsar/scripts/generate-zookeeper-config.sh
similarity index 100%
rename from docker/scripts/generate-zookeeper-config.sh
rename to docker/pulsar/scripts/generate-zookeeper-config.sh
diff --git a/docker/scripts/pulsar-zookeeper-ruok.sh b/docker/pulsar/scripts/pulsar-zookeeper-ruok.sh
similarity index 100%
rename from docker/scripts/pulsar-zookeeper-ruok.sh
rename to docker/pulsar/scripts/pulsar-zookeeper-ruok.sh


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services