-
Notifications
You must be signed in to change notification settings - Fork 23
Better builds + 9.0.0.3 + IHS shutdown fix #22
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
*.sh eol=lf | ||
*.csv eol=lf |
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} |
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 | ||
RUN tar xzf /ihs.tar.gz && rm /ihs.tar.gz | ||
ENV PATH /opt/IBM/HTTPServer/bin:$PATH | ||
CMD ["/work/ihsstart.sh"] |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 $? | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 $? | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I could add |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
*.zip | ||
*.tar.gz | ||
DockerFile.* |
This file was deleted.
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. |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 | ||
|
||
|
@@ -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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This was moved to Dockerfile There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.There was a problem hiding this comment.
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 thedocker 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?