Skip to content
This repository was archived by the owner on Jun 2, 2023. It is now read-only.

Better builds + 9.0.0.3 + IHS shutdown fix #22

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 2 additions & 0 deletions ilan/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*.sh eol=lf
*.csv eol=lf
68 changes: 45 additions & 23 deletions ilan/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,30 +1,52 @@
############################################################################
# (C) Copyright IBM Corporation 2015. #
# #
# Licensed 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. #
# #
############################################################################
###########################################################################
# (C) Copyright IBM Corporation 2015, 2016. #
# #
# Licensed 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. #
###########################################################################

# This Dockerfile is meant to download the requisite software and tar them
# up for the final DockerFile which will not have the IBM_ID and
# IBM_PASSWORD saved

FROM ubuntu:16.04

MAINTAINER Kavitha Suresh Kumar <[email protected]>
RUN apt-get update && apt-get install --no-install-recommends -y unzip bsdtar && rm -rf /var/lib/apt/lists/*
# BSD tar is need to prevent errors on Docker builds
# see https://github.com/docker/hub-feedback/issues/727
RUN export tar='bsdtar'

RUN apt-get update && apt-get install -y openssl wget
# Install IBM Installation Manager
COPY im/agent.installer.linux.gtk.x86_64_*.zip /tmp/
RUN unzip -qd /tmp/im /tmp/agent.installer.linux.gtk.x86_64_*.zip \
&& /tmp/im/installc -acceptLicense -accessRights nonAdmin \
-installationDirectory "/opt/IBM/InstallationManager" \
-dataLocation "/var/ibm/InstallationManager" -showProgress \
&& rm -rf /tmp/agent.installer.linux.gtk.x86_65_*.zip /tmp/im

ARG TAR_URL
ENV PATH /opt/IBM/InstallationManager/eclipse/tools:$PATH
RUN mkdir /host
RUN mkdir /target
COPY install_ihs.sh /host
COPY versions.csv /host
RUN chmod 700 /host/install_ihs.sh

COPY ihsstart.sh /work/
# requires envvars
ARG VERSION
ARG IBM_ID
ARG IBM_PASSWORD
RUN /host/install_ihs.sh
RUN tar zcf /target/ihs${VERSION}.tar.gz /opt/IBM/HTTPServer /opt/IBM/WebSphere/Plugins /opt/IBM/WebSphere/Toolbox

RUN wget -q -O - $TAR_URL | tar xz
ENV PATH /opt/IBM/HTTPServer/bin:$PATH
CMD ["/work/ihsstart.sh"]
# Build the version specific Docker file
COPY Dockerfile.template /host
RUN sed s/@VERSION@/${VERSION}/ /host/Dockerfile.template > /target/Dockerfile.${VERSION}
34 changes: 34 additions & 0 deletions ilan/Dockerfile.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
############################################################################
# (C) Copyright IBM Corporation 2015. #
# #
# Licensed 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. #
# #
############################################################################

# This is a template Dockerfile which will have version of the tar expected
# in the COPY command set during the previous docker build.

FROM ubuntu:16.04

MAINTAINER Kavitha Suresh Kumar <[email protected]>

RUN apt-get update && apt-get install --no-install-recommends -y unzip bsdtar && rm -rf /var/lib/apt/lists/*
# BSD tar is need to prevent errors on Docker builds
# see https://github.com/docker/hub-feedback/issues/727
RUN export tar='bsdtar'

COPY ihsstart.sh /work/
COPY im/ihs@[email protected] /ihs.tar.gz
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This step means that you end up with the .tar.gz in a layer in the final image even though it is hidden by the layer above. That's why the current approach serves up the files so that they can be pulled in, unpacked and then deleted all as part of the same layer.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm you're right I should have an rm after that step to get rid of the ihs.tar.gz file.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually that's because I don't use --squash on the docker build stage https://docs.docker.com/engine/reference/commandline/build/#squash-an-images-layers---squash-experimental-only it's still experimental but the end users should only get the final image rather than the whole history no?

RUN tar xzf /ihs.tar.gz && rm /ihs.tar.gz
ENV PATH /opt/IBM/HTTPServer/bin:$PATH
CMD ["/work/ihsstart.sh"]
3 changes: 2 additions & 1 deletion ilan/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@ Versions available:
8.5.5.9
8.5.5.10
9.0.0.0
9.0.0.3

Pre-req
You are required to download a version of IBM Installation Manager above version 8 and place it into the /ilan/im directory.
You are required to download a version of IBM Installation Manager above version 1.8 and place it into the /ilan/im directory.
Download Location: [IBM Support] (http://www-01.ibm.com/support/docview.wss?uid=swg27025142)

If you require all available versions of IHS then simply run the script buildAll with the arguments of a IBM ID and password. These are required for downloading the binaries as part of the installation. If you just want to build a specific version then you can run the build script with the version you require followed by an IBM ID and password.
Expand Down
12 changes: 5 additions & 7 deletions ilan/build
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,13 @@ if [ $# != 3 ]; then
exit 1
fi

docker build -t installation-manager im || exit $?
docker run --rm -v $(pwd):/host installation-manager /host/install_ihs $1 $2 $3 || exit $?
docker build -t installation-manager . --build-arg VERSION=$1 --build-arg IBM_ID=$2 --build-arg IBM_PASSWORD=$3|| exit $?
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

install_ihs.sh is called within docker during image build. The images are "cached up to the point of line 47. so there's no need to concern about installing Installation Manager again.


docker run -d --name tar_server -v $(pwd)/ihs$1.tar.gz:/host/ihs$1.tar.gz -w /host python:2-slim python -m SimpleHTTPServer
tar_server_ip=$(docker inspect --format '{{ .NetworkSettings.IPAddress }}' tar_server)
tar_url="http://${tar_server_ip}:8000/ihs${1}.tar.gz"
# copy the intermediate artifacts from /target

docker run installation-manager cat /target/ihs$1.tar.gz > im/ihs$1.tar.gz
docker run installation-manager cat /target/Dockerfile.$1 > im/Dockerfile.$1

# Build image from hosted tar file
echo "Building image"
docker build -t ibm-http-server:$1 --build-arg TAR_URL=$tar_url . || exit $?
docker rm -f tar_server
docker build -t ibm-http-server:$1 -f im/DockerFile.$1 . || exit $?
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could add --squash here to get rid of the intermediate images but the feature is still experimental in Docker 1.13 so I opted not to for now. The end result for the end users will not have the ihs.tar.gz file regardless.

37 changes: 2 additions & 35 deletions ilan/ihsstart.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,38 +7,5 @@
# #
#####################################################################################

startServer()
{
echo "Starting IBM HTTP Server "
# Starting IBM HTTPServer
/opt/IBM/HTTPServer/bin/apachectl start

if [ $? = 0 ]
then
echo "IBM HTTP Server started successfully"
else
echo "Failed to start IBM HTTP Server"
fi
}

stopServer()
{
echo "Stopping IBM HTTP Server "
# Stopping IBM HTTPServer
/opt/IBM/HTTPServer/bin/apachectl graceful-stop
if [ $? = 0 ]
then
echo "IBM HTTP Server stopped successfully"
fi
}

startServer

trap "stopServer" SIGTERM

sleep 10

while [ -f "/opt/IBM/HTTPServer/logs/httpd.pid" ]
do
sleep 5
done
. /opt/IBM/HTTPServer/bin/envvars
exec /opt/IBM/HTTPServer/bin/httpd -d /opt/IBM/HTTPServer -DFOREGROUND
3 changes: 3 additions & 0 deletions ilan/im/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
*.zip
*.tar.gz
DockerFile.*
31 changes: 0 additions & 31 deletions ilan/im/Dockerfile

This file was deleted.

3 changes: 3 additions & 0 deletions ilan/im/NOTES.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
This folder is where `agent.installer.linux.gtk.x85_64_*.zip` is expected to be stored. The file is ignored for source control.

In addition intermediate artifacts are stored here and will also be ignored by source control.
4 changes: 0 additions & 4 deletions ilan/install_ihs → ilan/install_ihs.sh
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@
# limitations under the License. #
###########################################################################

VERSION=$1
IBM_ID=$2
IBM_PASSWORD=$3
echo "Running build for versions: "$VERSION
SECURE_STORAGE_FILE=/tmp/credentials

Expand Down Expand Up @@ -79,4 +76,3 @@ function install_version() {


install_version
tar -zcf /host/ihs${VERSION}.tar.gz /opt/IBM/HTTPServer /opt/IBM/WebSphere/Plugins /opt/IBM/WebSphere/Toolbox
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was moved to Dockerfile

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@davidcurrie The installation-manager image is transient anyway it does not get pushed anywhere. But I did make most of these changes so I can do a build on Windows #20

1 change: 1 addition & 0 deletions ilan/versions.csv
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
8.5.5.10,/opt/IBM/HTTPServer|http://www.ibm.com/software/repositorymanager/com.ibm.websphere.IHSILAN.v85|com.ibm.websphere.IHSILAN.v85_8.5.5010.20160721_0036,/opt/IBM/WebSphere/Plugins|http://www.ibm.com/software/repositorymanager/com.ibm.websphere.PLGILAN.v85|com.ibm.websphere.PLGILAN.v85_8.5.5010.20160721_0036,/opt/IBM/WebSphere/Toolbox|http://www.ibm.com/software/repositorymanager/com.ibm.websphere.WCTILAN.v85|com.ibm.websphere.WCTILAN.v85_8.5.5010.20160721_0036
8.5.5.9,/opt/IBM/HTTPServer|http://www.ibm.com/software/repositorymanager/com.ibm.websphere.IHSILAN.v85|com.ibm.websphere.IHSILAN.v85_8.5.5009.20160225_0435,/opt/IBM/WebSphere/Plugins|http://www.ibm.com/software/repositorymanager/com.ibm.websphere.PLGILAN.v85|com.ibm.websphere.PLGILAN.v85_8.5.5009.20160225_0435,/opt/IBM/WebSphere/Toolbox|http://www.ibm.com/software/repositorymanager/com.ibm.websphere.WCTILAN.v85|com.ibm.websphere.WCTILAN.v85_8.5.5009.20160225_0435
9.0.0.0,/opt/IBM/HTTPServer|http://www.ibm.com/software/repositorymanager/com.ibm.websphere.IHS.v90|com.ibm.java.jdk.v8 com.ibm.websphere.IHS.v90_9.0.0.20160526_1854,/opt/IBM/WebSphere/Plugins|http://www.ibm.com/software/repositorymanager/com.ibm.websphere.PLG.v90|com.ibm.java.jdk.v8 com.ibm.websphere.PLG.v90_9.0.1.20160906_0049,/opt/IBM/WebSphere/Toolbox|http://www.ibm.com/software/repositorymanager/com.ibm.websphere.WCT.v90|com.ibm.java.jdk.v8 com.ibm.websphere.WCT.v90_9.0.0.20160526_1854
9.0.0.3,/opt/IBM/HTTPServer|http://www.ibm.com/software/repositorymanager/com.ibm.websphere.IHS.v90|com.ibm.java.jdk.v8 com.ibm.websphere.IHS.v90_9.0.3.20170217_1945,/opt/IBM/WebSphere/Plugins|http://www.ibm.com/software/repositorymanager/com.ibm.websphere.PLG.v90|com.ibm.java.jdk.v8 com.ibm.websphere.PLG.v90_9.0.3.20170217_1945,/opt/IBM/WebSphere/Toolbox|http://www.ibm.com/software/repositorymanager/com.ibm.websphere.WCT.v90|com.ibm.java.jdk.v8 com.ibm.websphere.WCT.v90_9.0.3.20170217_1945