-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added a customer Docker image, fixes #2
- Loading branch information
Showing
6 changed files
with
204 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
FROM registry.centos.org/che-stacks/centos-jdk8 | ||
|
||
LABEL che:server:8080:ref=quarkus-dev che:server:8080:protocol=http che:server:5005:ref=quarkus-debug che:server:5005:protocol=http che:server:9876:ref=codeserver che:server:9876:protocol=http | ||
|
||
ARG OC_VERSION=3.11.43 | ||
ARG QUARKUS_VERSION=0.12.0 | ||
|
||
COPY ["./general-deps.install", "/tmp/install/"] | ||
RUN sudo chown user:user /tmp/install /tmp/install/* && \ | ||
/tmp/install/general-deps.install ${OC_VERSION} && \ | ||
sudo rm -rf /tmp/install | ||
|
||
|
||
# The following lines are needed to set the correct locale after `yum update` | ||
# c.f. https://github.com/CentOS/sig-cloud-instance-images/issues/71 | ||
RUN sudo localedef -i en_US -f UTF-8 C.UTF-8 | ||
ENV LANG="C.UTF-8" | ||
|
||
# Generate group.template | ||
RUN cat /etc/group | \ | ||
sed s#root:x:0:#root:x:0:0,\${USER_ID}:#g \ | ||
> /home/user/group.template | ||
|
||
ENV HOME /home/user | ||
ENV M2_HOME=/opt/apache-maven-3.6.0 | ||
|
||
COPY ["./download-maven-deps.sh", "/tmp/maven-deps/"] | ||
RUN sudo chown user:user /tmp/maven-deps /tmp/maven-deps/* && \ | ||
/tmp/maven-deps/download-maven-deps.sh ${QUARKUS_VERSION} && \ | ||
sudo rm -rf /tmp/maven-deps | ||
|
||
COPY ["./entrypoint.sh", "/home/user/entrypoint.sh"] | ||
ENTRYPOINT ["/home/user/entrypoint.sh"] | ||
CMD tail -f /dev/null | ||
|
||
# Give write access to /home/user for users with an arbitrary UID | ||
COPY ["./grant-access-arbitrary-UID.sh", "/tmp/install/"] | ||
RUN sudo chown user:user /tmp/install /tmp/install/* && \ | ||
/tmp/install/grant-access-arbitrary-UID.sh && \ | ||
sudo rm -rf /tmp/install |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#!/bin/bash | ||
# Copyright (c) 2018 Red Hat, Inc. | ||
# All rights reserved. This program and the accompanying materials | ||
# are made available under the terms of the Eclipse Public License v1.0 | ||
# which accompanies this distribution, and is available at | ||
# http://www.eclipse.org/legal/epl-v10.html | ||
# | ||
# | ||
|
||
set -e | ||
set -u | ||
|
||
SCRIPT_DIR=$(cd "$(dirname "$0")"; pwd) | ||
|
||
## | ||
# Clone and run `mvn clean package` on a repository, removing all | ||
# downloaded files after completion. Used to download dependencies | ||
# to the local maven repository. | ||
# | ||
# params: | ||
# ${1} - Repository to download | ||
# ${2} - branch/tag to check out | ||
## | ||
git_clone_and_build() { | ||
BRANCH=${1} | ||
cd "${HOME}" | ||
CURRENT_FOLDER=$(pwd) | ||
mkdir -p tmp-folder | ||
wget -qO tmp.zip "https://github.com/quarkusio/quarkus-quickstarts/archive/${BRANCH}.zip" | ||
unzip tmp.zip -d tmp-folder | ||
pushd tmp-folder/quarkus-quickstarts-${BRANCH} | ||
./mvnw -f getting-started/pom.xml quarkus:list-extensions | ||
for qs in $(ls */pom.xml | sed "s/\/pom.xml//g" | grep -v hibernate-orm) | ||
do | ||
./mvnw -B -f ${qs}/pom.xml package | ||
done | ||
#cd tmp-folder/quarkus-quickstarts-${BRANCH} && ./mvnw -f getting-started/pom.xml quarkus:list-extensions && ./mvnw verify -f getting-started/pom.xml && ./mvnw -B clean package -DskipTests | ||
popd | ||
rm -rf tmp-folder | ||
} | ||
|
||
QUARKUS_VERSION=${1} | ||
echo "Downloading quickstart for Quarkus version: $QUARKUS_VERSION" | ||
git_clone_and_build $QUARKUS_VERSION |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
#!/bin/bash | ||
# Copyright (c) 2012-2017 Red Hat, Inc. | ||
# All rights reserved. This program and the accompanying materials | ||
# are made available under the terms of the Eclipse Public License v1.0 | ||
# which accompanies this distribution, and is available at | ||
# http://www.eclipse.org/legal/epl-v10.html | ||
# Contributors: | ||
# Red Hat, Inc. - initial implementation | ||
|
||
set -e | ||
|
||
export USER_ID=$(id -u) | ||
export GROUP_ID=$(id -g) | ||
|
||
if ! grep -Fq "${USER_ID}" /etc/passwd; then | ||
envsubst < ${HOME}/passwd.template > /etc/passwd | ||
envsubst < ${HOME}/group.template > /etc/group | ||
|
||
# The trick below is the one that is suggested here | ||
# https://docs.openshift.com/enterprise/3.2/creating_images/guidelines.html#openshift-enterprise-specific-guidelines | ||
# But every new exec call won't work because | ||
# LD_PRELOAD, NSS_WRAPPER_PASSWD and NSS_WRAPPER_GROUP | ||
# are not set there. | ||
# | ||
# envsubst < ${HOME}/passwd.template > /tmp/passwd | ||
# envsubst < ${HOME}/group.template > /tmp/group | ||
# export LD_PRELOAD=/usr/local/lib/libnss_wrapper.so | ||
# export NSS_WRAPPER_PASSWD=/tmp/passwd | ||
# export NSS_WRAPPER_GROUP=/tmp/group | ||
touch ${HOME}/is_arbitrary_user | ||
fi | ||
|
||
# SSH agent is currently not supported but if we | ||
# do want to support it we can uncomment the code below | ||
# and fix SSHAgentLauncher that has SSHD port hardcoded | ||
# to 22 and will expect the service to be available at that | ||
# port. And we cannot use port 22 because it's a | ||
# privileged port and OpenShift will complain. | ||
# | ||
# SSHD_PORT=2222 | ||
# /usr/bin/ssh-keygen -A | ||
# mkdir -p /home/user/.ssh | ||
# chmod 700 /home/user/.ssh | ||
# echo "UsePrivilegeSeparation no" > /home/user/.ssh/sshd_config | ||
# /usr/sbin/sshd -D -p ${SSHD_PORT} -f /home/user/.ssh/sshd_config & | ||
|
||
exec "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#!/bin/bash | ||
# Copyright (c) 2012-2017 Red Hat, Inc. | ||
# All rights reserved. This program and the accompanying materials | ||
# are made available under the terms of the Eclipse Public License v1.0 | ||
# which accompanies this distribution, and is available at | ||
# http://www.eclipse.org/legal/epl-v10.html | ||
# Contributors: | ||
# Red Hat, Inc. - initial implementation | ||
# | ||
# Install general dependencies required by all images. Note that | ||
# yum will skip already installed dependencies, and so will not | ||
# increase image size unnecesssarily. | ||
# | ||
# usage: | ||
# general-deps.install <OC_VERSION> [<JAVA_VERSION>] | ||
# note: JAVA_VERSION defaults to 1.8.0 | ||
##### | ||
|
||
set -u | ||
set -e | ||
|
||
OC_VERSION=${1} | ||
JAVA_VERSION=${2:-1.8.0} | ||
|
||
sudo yum update -y -d 1 \ | ||
&& sudo yum install -y -d 1 \ | ||
bzip2 \ | ||
curl \ | ||
gettext \ | ||
git \ | ||
java-${JAVA_VERSION}-openjdk-devel \ | ||
tar \ | ||
wget \ | ||
&& sudo wget -qO- "https://mirror.openshift.com/pub/openshift-v3/clients/${OC_VERSION}/linux/oc.tar.gz" \ | ||
| sudo tar xvz -C /usr/local/bin \ | ||
&& sudo wget -qO- "http://mirrors.ibiblio.org/apache/maven/maven-3/3.6.0/binaries/apache-maven-3.6.0-bin.tar.gz" \ | ||
| sudo tar xvz -C /opt \ | ||
&& sudo yum clean all \ | ||
&& sudo rm -rf /var/cache/yum |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#!/bin/bash | ||
# Copyright (c) 2012-2017 Red Hat, Inc. | ||
# All rights reserved. This program and the accompanying materials | ||
# are made available under the terms of the Eclipse Public License v1.0 | ||
# which accompanies this distribution, and is available at | ||
# http://www.eclipse.org/legal/epl-v10.html | ||
# Contributors: | ||
# Red Hat, Inc. - initial implementation | ||
# | ||
# Change owner and group of /home/user, /etc/passwd, /etc/group/ | ||
# /projects and /tmp directories, to allow users with arbitrary UIDs. | ||
##### | ||
|
||
set -u | ||
set -e | ||
|
||
sudo chgrp -R 0 /home/user \ | ||
&& sudo chmod -R g+rwX /home/user \ | ||
&& sudo chgrp -R 0 /etc/passwd \ | ||
&& sudo chmod -R g+rwX /etc/passwd \ | ||
&& sudo chgrp -R 0 /etc/group \ | ||
&& sudo chmod -R g+rwX /etc/group \ | ||
&& sudo mkdir -p /projects \ | ||
&& sudo chgrp -R 0 /projects \ | ||
&& sudo chmod -R g+rwX /projects \ | ||
&& sudo chgrp -R 0 /tmp \ | ||
&& sudo chmod -R g+rwX /tmp |