Skip to content

Commit

Permalink
fixes for building OpenJ9 using docker (#1171)
Browse files Browse the repository at this point in the history
* fixes for building OpenJ9 using docker

 * some shell script changes to avoid errors from `set -u`
 * separate the openj9 Dockerfile from the base dockerfile
  • Loading branch information
andyleiserson authored and sxa555 committed Oct 8, 2019
1 parent 35397b3 commit 6c670c8
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 10 deletions.
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
workspace/build/
6 changes: 3 additions & 3 deletions docker-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -143,16 +143,16 @@ buildOpenJDKViaDocker()
-v "${hostDir}"/pipelines:/openjdk/pipelines
-e "DEBUG_DOCKER_FLAG=${BUILD_CONFIG[DEBUG_DOCKER]}"
-e "BUILD_VARIANT=${BUILD_CONFIG[BUILD_VARIANT]}"
"${dockerEntrypoint[@]}")
"${dockerEntrypoint[@]:+${dockerEntrypoint[@]}}")

# If build specifies --ssh, add array to the command string
if [[ "${BUILD_CONFIG[USE_SSH]}" == "true" ]] ; then
commandString=("${gitSshAccess[@]}" "${commandString[@]}")
commandString=("${gitSshAccess[@]:+${gitSshAccess[@]}}" "${commandString[@]}")
fi

# If build specifies --debug-docker, add array to the command string
if [[ "${BUILD_CONFIG[DEBUG_DOCKER]}" == "true" ]] ; then
commandString=("${dockerMode[@]}" "${commandString[@]}")
commandString=("${dockerMode[@]:+${dockerMode[@]}}" "${commandString[@]}")
echo "DEBUG DOCKER MODE. To build jdk run /openjdk/sbin/build.sh"
fi

Expand Down
3 changes: 2 additions & 1 deletion docker/jdk8/x86_64/ubuntu/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,12 @@ RUN apt-get update \
libxt-dev \
libxtst-dev \
make \
ssh \
systemtap-sdt-dev \
unzip \
wget \
zip \
ssh \
zulu-7 \
&& rm -rf /var/lib/apt/lists/*

# Pick up build instructions
Expand Down
39 changes: 34 additions & 5 deletions docker/jdk8/x86_64/ubuntu/Dockerfile-openj9
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

FROM openjdk_container
FROM ubuntu:16.04

MAINTAINER AdoptOpenJDK <[email protected]>

Expand All @@ -21,26 +21,55 @@ RUN apt-get update \
autoconf \
ccache \
cpio \
curl \
file \
g++-4.8 \
gcc-4.8 \
git \
gnupg2 \
libasound2-dev \
libcups2-dev \
libdwarf-dev \
libelf-dev \
libfontconfig \
libfontconfig1-dev \
libfreetype6-dev \
libnuma-dev \
libx11-dev \
libxext-dev \
libxrender-dev \
libxt-dev \
libxtst-dev \
make \
nasm \
openjdk-8-jdk \
pkg-config \
ssh \
unzip \
wget \
zip \
&& rm -rf /var/lib/apt/lists/*

# Make sure build uses 4.8
RUN rm /usr/bin/gcc \
&& rm /usr/bin/g++ \
&& rm /usr/bin/c++ \
RUN rm -f /usr/bin/gcc \
&& rm -f /usr/bin/g++ \
&& rm -f /usr/bin/c++ \
&& ln -s /usr/bin/gcc-4.8 /usr/bin/gcc \
&& ln -s /usr/bin/g++-4.8 /usr/bin/g++ \
&& ln -s /usr/bin/g++-4.8 /usr/bin/c++

# Pick up build instructions
RUN mkdir -p /openjdk/target

COPY sbin /openjdk/sbin
COPY workspace/config /openjdk/config
COPY pipelines /openjdk/pipelines

RUN mkdir -p /openjdk/build
RUN useradd -ms /bin/bash build
RUN chown -R build: /openjdk/
USER build
WORKDIR /openjdk/build/

ARG OPENJDK_CORE_VERSION
ENV OPENJDK_CORE_VERSION=$OPENJDK_CORE_VERSION
ENV JDK_PATH=jdk
2 changes: 1 addition & 1 deletion sbin/common/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ function crossPlatformRealPath() {
local name=$(basename "$target")
fi

local fullPath="$PWD/$name"
local fullPath="$PWD/${name:+${name}}"
cd "$currentDir"
echo "$fullPath"
}
Expand Down

0 comments on commit 6c670c8

Please sign in to comment.