Skip to content
Permalink
Browse files
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
  • Loading branch information
ahgittin committed Nov 1, 2016
1 parent 5fe9910 commit 6a47cf24090a97b2e1ac8c768b33afa2cd8c0c25
Showing 3 changed files with 110 additions and 41 deletions.
@@ -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 []

@@ -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 []

@@ -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


0 comments on commit 6a47cf2

Please sign in to comment.