Skip to content

Instantly share code, notes, and snippets.

@rafabene
Created May 31, 2016 20:01
Show Gist options
  • Save rafabene/c7b7f83c5c4ddf404a8ead05a4c4364d to your computer and use it in GitHub Desktop.
Save rafabene/c7b7f83c5c4ddf404a8ead05a4c4364d to your computer and use it in GitHub Desktop.
Docker che with RHEL and EAP
# JBoss, Home of Professional Open Source
# Copyright 2016, Red Hat, Inc. and/or its affiliates, and individual
# contributors by the @authors tag. See the copyright.txt in the
# distribution for a full listing of individual contributors.
#
# 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.
FROM registry.access.redhat.com/rhel
LABEL che:server:8080:ref=eap che:server:9990:ref=jboss che:server:8080:protocol=http che:server:8000:ref=eap-debug che:server:8000:protocol=http
ARG SUB_USERNAME
ENV SUB_USERNAME ${SUB_USERNAME}
ARG SUB_PASSWORD
ENV SUB_PASSWORD ${SUB_PASSWORD}
RUN subscription-manager register --username=$SUB_USERNAME --password=$SUB_PASSWORD --auto-attach && \
yum update -y && \
yum install -y hostname sudo openssh-server pkgconfig openssl procps wget unzip mc curl subversion nmap git tar && \
mkdir /var/run/sshd && \
sed 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g' -i /etc/pam.d/sshd && \
echo "user ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers && \
sed -i 's/Defaults requiretty/#Defaults requiretty/g' /etc/sudoers && \
useradd -u 1000 -G users -d /home/user --shell /bin/bash -m user && \
echo "secret" | passwd user --stdin && \
rm /var/run/nologin && \
yum clean all && \
subscription-manager clean
USER user
ENV TERM xterm
ENV MAVEN_VERSION=3.3.9 \
JAVA_VERSION=8u45 \
JAVA_VERSION_PREFIX=1.8.0_45
ENV JAVA_HOME=/opt/jdk$JAVA_VERSION_PREFIX \
M2_HOME=/home/user/apache-maven-$MAVEN_VERSION
ENV PATH=$JAVA_HOME/bin:$M2_HOME/bin:$PATH
ENV LANG en_US.UTF-8
ENV LANGUAGE en_US:en
ENV LC_ALL en_US.UTF-8
RUN mkdir /home/user/apache-maven-$MAVEN_VERSION && \
wget \
--no-cookies \
--no-check-certificate \
--header "Cookie: oraclelicense=accept-securebackup-cookie" \
-qO- \
"http://download.oracle.com/otn-pub/java/jdk/$JAVA_VERSION-b14/jdk-$JAVA_VERSION-linux-x64.tar.gz" | sudo tar -zx -C /opt/ && \
wget -qO- "http://apache.ip-connect.vn.ua/maven/maven-3/$MAVEN_VERSION/binaries/apache-maven-$MAVEN_VERSION-bin.tar.gz" | tar -zx --strip-components=1 -C /home/user/apache-maven-$MAVEN_VERSION/
ADD jboss-eap-7.0.0.zip /home/user
RUN cd /home/user && \
unzip jboss-eap-7.0.0.zip && \
sed -i 's/127.0.0.1/0.0.0.0/g' /home/user/jboss-eap-7.0/standalone/configuration/standalone.xml
RUN printf "export JAVA_HOME=/opt/jdk$JAVA_VERSION_PREFIX\nexport M2_HOME=/home/user/apache-maven-$MAVEN_VERSION\nexport PATH=$JAVA_HOME/bin:$M2_HOME/bin:$PATH" >> /home/user/.bashrc
WORKDIR /projects
USER root
EXPOSE 4403 8000 8080 9990 22
RUN sshd-keygen
CMD /usr/sbin/sshd -D
Download EAP 7.0.0 from Customer portal and place it in the same folder of the Dockerfile
Execute: docker build -t <IMAGE_NAME> --build-arg=SUB_USERNAME=<RH_USERNAME> --build-arg=SUB_PASSWORD=<RH_PASSWORD> .
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment