You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@brooklyn.apache.org by sv...@apache.org on 2017/02/14 17:05:26 UTC

[02/12] brooklyn-dist git commit: switched to alpine

switched to alpine

working alpine and ubuntu images:

    REPOSITORY                 TAG                     IMAGE ID            CREATED             SIZE
    brooklyncentral/brooklyn   0.10.0-SNAPSHOT-debug   b062efb658b5        4 minutes ago       570.8 MB
    brooklyncentral/brooklyn   0.10.0-SNAPSHOT         9530e7fa762c        10 minutes ago      288.2 MB


Project: http://git-wip-us.apache.org/repos/asf/brooklyn-dist/repo
Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-dist/commit/6a47cf24
Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-dist/tree/6a47cf24
Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-dist/diff/6a47cf24

Branch: refs/heads/master
Commit: 6a47cf24090a97b2e1ac8c768b33afa2cd8c0c25
Parents: 5fe9910
Author: Alex Heneveld <al...@cloudsoftcorp.com>
Authored: Tue Nov 1 18:13:17 2016 +0000
Committer: Alex Heneveld <al...@cloudsoftcorp.com>
Committed: Tue Nov 1 18:13:17 2016 +0000

----------------------------------------------------------------------
 docker/Dockerfile              | 60 +++++++++++++-----------------
 docker/Dockerfile-debug-ubuntu | 74 +++++++++++++++++++++++++++++++++++++
 docker/Makefile                | 17 ++++++---
 3 files changed, 110 insertions(+), 41 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/brooklyn-dist/blob/6a47cf24/docker/Dockerfile
----------------------------------------------------------------------
diff --git a/docker/Dockerfile b/docker/Dockerfile
index 9ad45f5..3fa689a 100644
--- a/docker/Dockerfile
+++ b/docker/Dockerfile
@@ -18,51 +18,41 @@
 #
 
 
-FROM ubuntu:latest
+FROM openjdk:8-jre-alpine
 MAINTAINER Alex Heneveld "alex@cloudsoft.io"
 
-RUN apt-get update
-
-# pre-reqs for Brooklyn
-RUN apt-get install -y default-jre
-
-# and for the script
-RUN apt-get install -y ssh
-
-ARG debug
-
-# admin tools (optional)
-RUN if [ -n "${debug}" ] ; then apt-get install -y vim ; fi
-RUN if [ -n "${debug}" ] ; then apt-get install -y zip tar less curl ; fi
-RUN if [ -n "${debug}" ] ; then apt-get install -y sudo ; fi
-
-RUN adduser brooklyn
+RUN apk add --update bash openssh && rm -rf /var/cache/apk/*
+RUN adduser -D brooklyn
 WORKDIR /home/brooklyn
 
+# now install software brooklyn
 COPY target/files/ .
-RUN cp ./bin/br /usr/bin/br
-RUN chown -R brooklyn:brooklyn .
+RUN \
+  # remove option not relevan for java v8 \
+  sed -i.bk "s/ -XX:MaxPermSize=256m//" bin/brooklyn ; \
+  # install br for global use \
+  cp ./bin/br /usr/bin/br ; \
+  # and fix perms (irritating that docker won't do this) \
+  chown -R brooklyn:brooklyn .
 
 USER brooklyn
 
-# remove option not relevant for java v8
-RUN sed -i.bk "s/ -XX:MaxPermSize=256m//" bin/brooklyn
-
+# handle customisation, including passing args through to the container script and installing boms
 ARG application
 ARG install_bom
-
-RUN if [ -n "${debug}" ] ; then echo debug=true >> brooklyn-docker-start.opts ; fi
-RUN if [ -n "${application}" ] ; then echo application=${application} >> brooklyn-docker-start.opts ; fi
-
-RUN if [ -n "${install_bom}" ] ; then \
-  echo "brooklyn.catalog:" > conf/brooklyn/default.catalog.bom ; \
-  echo "  items:" >> conf/brooklyn/default.catalog.bom ; \
-  for x in ${install_bom} ; do \
-    echo Installing $x to catalog ; \
-    echo "  - "$x >> conf/brooklyn/default.catalog.bom ; \
-  done \
-fi
-
+RUN \
+  if [ -n "${debug}" ] ; then echo debug=true >> brooklyn-docker-start.opts ; fi ; \
+  if [ -n "${application}" ] ; then echo application=${application} >> brooklyn-docker-start.opts ; fi ; \
+  if [ -n "${install_bom}" ] ; then \
+    echo "brooklyn.catalog:" > conf/brooklyn/default.catalog.bom ; \
+    echo "  items:" >> conf/brooklyn/default.catalog.bom ; \
+    for x in ${install_bom} ; do \
+      echo Installing $x to catalog ; \
+      echo "  - "$x >> conf/brooklyn/default.catalog.bom ; \
+    done \
+  fi
+
+# and start
 ENTRYPOINT ["bin/brooklyn-docker-start"]
 CMD []
 

http://git-wip-us.apache.org/repos/asf/brooklyn-dist/blob/6a47cf24/docker/Dockerfile-debug-ubuntu
----------------------------------------------------------------------
diff --git a/docker/Dockerfile-debug-ubuntu b/docker/Dockerfile-debug-ubuntu
new file mode 100644
index 0000000..683a90e
--- /dev/null
+++ b/docker/Dockerfile-debug-ubuntu
@@ -0,0 +1,74 @@
+#
+# 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.
+#
+
+
+FROM ubuntu:latest
+# other options: alpine:latest openjdk:8-jre-alpine
+
+MAINTAINER Alex Heneveld "alex@cloudsoft.io"
+
+RUN \
+  apt-get update ; \
+  apt-get install -y openjdk-8-jre-headless ; \
+  # options: openjdk-8-jre-headless default-jre ; \
+  apt-get install -y ssh
+
+# debug installs extra things
+ENV debug true
+RUN \
+  if [ -n "${debug}" ] ; then \
+    apt-get update ; \
+    apt-get install -y sudo zip tar less curl vim ; \
+  fi
+
+# run as user brooklyn
+RUN adduser brooklyn < /dev/null
+WORKDIR /home/brooklyn
+
+# now install software brooklyn
+COPY target/files/ .
+RUN \
+  # remove option not relevan for java v8 \
+  sed -i.bk "s/ -XX:MaxPermSize=256m//" bin/brooklyn ; \
+  # install br for global use \
+  cp ./bin/br /usr/bin/br ; \
+  # and fix perms (irritating that docker won't do this) \
+  chown -R brooklyn:brooklyn .
+
+USER brooklyn
+
+# handle customisation, including passing args through to the container script and installing boms
+ARG application
+ARG install_bom
+RUN \
+  if [ -n "${debug}" ] ; then echo debug=true >> brooklyn-docker-start.opts ; fi ; \
+  if [ -n "${application}" ] ; then echo application=${application} >> brooklyn-docker-start.opts ; fi ; \
+  if [ -n "${install_bom}" ] ; then \
+    echo "brooklyn.catalog:" > conf/brooklyn/default.catalog.bom ; \
+    echo "  items:" >> conf/brooklyn/default.catalog.bom ; \
+    for x in ${install_bom} ; do \
+      echo Installing $x to catalog ; \
+      echo "  - "$x >> conf/brooklyn/default.catalog.bom ; \
+    done \
+  fi
+
+# and start
+ENTRYPOINT ["bin/brooklyn-docker-start"]
+CMD []
+

http://git-wip-us.apache.org/repos/asf/brooklyn-dist/blob/6a47cf24/docker/Makefile
----------------------------------------------------------------------
diff --git a/docker/Makefile b/docker/Makefile
index 7d1efa1..c53d6fe 100644
--- a/docker/Makefile
+++ b/docker/Makefile
@@ -16,28 +16,33 @@ image-only:
 	docker build -t brooklyncentral/brooklyn:$(BROOKLYN_VERSION) .
 
 image-debug: prep
-	docker build -t brooklyncentral/brooklyn:${BROOKLYN_VERSION} --build-arg debug=true .
+        # image based on ubuntu (instead of alpine) with more tools installed and better debug output
+	docker build -t brooklyncentral/brooklyn:${BROOKLYN_VERSION}-debug -f Dockerfile-debug-ubuntu .
 
 all: prep image-only
 
-# copy this if you want to pass arguments
+
+# illustrations, useful for copy-pasting
+
 run:
         # BROOKLYN_VERSION_BELOW
-	docker run -p 8081:8081 brooklyncentral/brooklyn:0.10.0-SNAPSHOT
+	docker run -d -p 8081:8081 brooklyncentral/brooklyn:0.10.0-SNAPSHOT --password S3CR3T > /tmp/brooklyn_container
+	docker logs -f `cat /tmp/brooklyn_container`
 
 run-shell:
 	docker run -ti --entrypoint /bin/bash brooklyncentral/brooklyn:$(BROOKLYN_VERSION)
 
 
-# an example
+# an example pre-installing blueprints and even taking a location as argument to quick launch
 
 example-image-hyperledger: prep
 	docker build -t brooklyncentral/brooklyn-hyperledger \
 	  --build-arg install_bom="https://raw.githubusercontent.com/cloudsoft/brooklyn-hyperledger/master/docker.bom https://raw.githubusercontent.com/cloudsoft/brooklyn-hyperledger/master/catalog.bom" \
-          --build-arg application=hyperledger-fabric-multi-cluster-application \
+          --build-arg application=hyperledger-fabric-single-cluster-application \
 	  .
 
 example-run-hyperledger:
-	docker run -p 8081:8081 brooklyncentral/brooklyn-hyperledger
+	# add   id:cred@cloud   as an argument to launch the blueprint in that cloud
+	docker run -p 8081:8081 brooklyncentral/brooklyn-hyperledger --password S3CR3T