diff --git a/recipes/php/5.6/Dockerfile b/recipes/php/5.6/Dockerfile index 881d2e87..1ca97ffe 100644 --- a/recipes/php/5.6/Dockerfile +++ b/recipes/php/5.6/Dockerfile @@ -1,4 +1,4 @@ -FROM eclipse/stack-base:debian +FROM eclipse/stack-base:debian-jessie ENV DEBIAN_FRONTEND noninteractive ENV CHE_MYSQL_PASSWORD=che ENV CHE_MYSQL_DB=che_db @@ -43,4 +43,4 @@ RUN sudo apt-get update && \ sudo service mysql restart && sudo mysql -u root --password="root" -e "CREATE USER '$CHE_MYSQL_USER'@'%' IDENTIFIED BY '"$CHE_MYSQL_PASSWORD"'" && \ sudo mysql -u root --password="root" -e "GRANT ALL PRIVILEGES ON *.* TO '$CHE_MYSQL_USER'@'%' IDENTIFIED BY '"$CHE_MYSQL_PASSWORD"'; FLUSH PRIVILEGES;" && \ sudo mysql -u root --password="root" -e "CREATE DATABASE $CHE_MYSQL_DB;" -EXPOSE 80 \ No newline at end of file +EXPOSE 80 diff --git a/recipes/stack-base/debian b/recipes/stack-base/debian new file mode 120000 index 00000000..9d022458 --- /dev/null +++ b/recipes/stack-base/debian @@ -0,0 +1 @@ +debian-stretch \ No newline at end of file diff --git a/recipes/stack-base/debian-jessie/Dockerfile b/recipes/stack-base/debian-jessie/Dockerfile new file mode 100644 index 00000000..8919655c --- /dev/null +++ b/recipes/stack-base/debian-jessie/Dockerfile @@ -0,0 +1,57 @@ +# Copyright (c) 2012-2016 Codenvy, S.A. +# 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: +# Codenvy, S.A. - initial API and implementation + +FROM debian:jessie-backports + +ARG OPENJDK_VERSION=8u171-b11-1~bpo8+1 + +ENV JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-amd64 +ENV PATH $JAVA_HOME/bin:$PATH +RUN apt-get update && \ + apt-get -y install \ + openssh-server \ + sudo \ + rsync \ + procps \ + -t jessie-backports \ + openjdk-8-jdk-headless=$OPENJDK_VERSION \ + openjdk-8-source=$OPENJDK_VERSION \ + wget \ + unzip \ + mc \ + locales \ + ca-certificates \ + curl \ + bash-completion \ + git \ + subversion && \ + 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 "%sudo ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers && \ + useradd -u 1000 -G users,sudo -d /home/user --shell /bin/bash -m user && \ + usermod -p "*" user && \ + apt-get clean && \ + apt-get -y autoremove \ + && apt-get -y clean \ + && rm -rf /var/lib/apt/lists/* && \ + echo "#! /bin/bash\n set -e\n sudo /usr/sbin/sshd -D &\n exec \"\$@\"" > /home/user/entrypoint.sh && chmod a+x /home/user/entrypoint.sh + +COPY open-jdk-source-file-location /open-jdk-source-file-location +RUN sed -i -e "s/{{OPENJDK_VERSION}}/$OPENJDK_VERSION/g" /open-jdk-source-file-location + +ENV LANG C.UTF-8 +USER user +RUN sudo localedef -i en_US -f UTF-8 en_US.UTF-8 && \ + svn --version && \ + sed -i 's/# store-passwords = no/store-passwords = yes/g' /home/user/.subversion/servers && \ + sed -i 's/# store-plaintext-passwords = no/store-plaintext-passwords = yes/g' /home/user/.subversion/servers + +EXPOSE 22 4403 +WORKDIR /projects +ENTRYPOINT ["/home/user/entrypoint.sh"] +CMD tail -f /dev/null diff --git a/recipes/stack-base/debian/entrypoint.sh b/recipes/stack-base/debian-jessie/entrypoint.sh similarity index 100% rename from recipes/stack-base/debian/entrypoint.sh rename to recipes/stack-base/debian-jessie/entrypoint.sh diff --git a/recipes/stack-base/debian/open-jdk-source-file-location b/recipes/stack-base/debian-jessie/open-jdk-source-file-location similarity index 99% rename from recipes/stack-base/debian/open-jdk-source-file-location rename to recipes/stack-base/debian-jessie/open-jdk-source-file-location index 6977f8e5..b4bd5987 100644 --- a/recipes/stack-base/debian/open-jdk-source-file-location +++ b/recipes/stack-base/debian-jessie/open-jdk-source-file-location @@ -2,8 +2,8 @@ This package distributes OpenJDK binaries that are licensed under the GPL. The source code and build scripts used to create this binary are available for download at: OpenJDK Package installed via package manager: openjdk-8-jre-headless, openjdk-8-source -OpenJDK version: 8u171-b11-1~bpo8+1 -OpenJDK sources: http://cdn-fastly.deb.debian.org/debian/pool/main/o/openjdk-8/openjdk-8_8u171-b11-1~bpo8+1.debian.tar.xz +OpenJDK version: {{OPENJDK_VERSION}} +OpenJDK sources: http://cdn-fastly.deb.debian.org/debian/pool/main/o/openjdk-8/openjdk-8_{{OPENJDK_VERSION}}.debian.tar.xz The following license applies to OpenJDK diff --git a/recipes/stack-base/debian/Dockerfile b/recipes/stack-base/debian-stretch/Dockerfile similarity index 78% rename from recipes/stack-base/debian/Dockerfile rename to recipes/stack-base/debian-stretch/Dockerfile index e3f7c0d0..5aea308a 100644 --- a/recipes/stack-base/debian/Dockerfile +++ b/recipes/stack-base/debian-stretch/Dockerfile @@ -8,19 +8,20 @@ # Contributors: # Red Hat, Inc. - initial API and implementation -FROM debian:jessie +FROM debian:stretch ENV JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-amd64 ENV PATH $JAVA_HOME/bin:$PATH -RUN echo "deb http://http.debian.net/debian jessie-backports main" >> /etc/apt/sources.list && \ - apt-get update && \ +RUN apt-get update && \ apt-get -y install \ + git \ + subversion \ + gnupg2 \ openssh-server \ sudo \ rsync \ procps \ - -t jessie-backports \ - openjdk-8-jdk-headless=8u171-b11-1~bpo8+1 \ - openjdk-8-source=8u171-b11-1~bpo8+1 \ + openjdk-8-jdk-headless \ + openjdk-8-source \ wget \ unzip \ mc \ @@ -34,9 +35,6 @@ RUN echo "deb http://http.debian.net/debian jessie-backports main" >> /etc/apt/s # Adding user to the 'root' is a workaround for https://issues.jboss.org/browse/CDK-305 useradd -u 1000 -G users,sudo,root -d /home/user --shell /bin/bash -m user && \ usermod -p "*" user && \ - sudo echo -e "deb http://ppa.launchpad.net/git-core/ppa/ubuntu precise main\ndeb-src http://ppa.launchpad.net/git-core/ppa/ubuntu precise main" >> /etc/apt/sources.list.d/sources.list && \ - sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys A1715D88E1DF1F24 && \ - sudo apt-get install git subversion -y && \ apt-get clean && \ apt-get -y autoremove \ && apt-get -y clean \ @@ -48,7 +46,6 @@ RUN sudo localedef -i en_US -f UTF-8 en_US.UTF-8 && \ svn --version && \ sed -i 's/# store-passwords = no/store-passwords = yes/g' /home/user/.subversion/servers && \ sed -i 's/# store-plaintext-passwords = no/store-plaintext-passwords = yes/g' /home/user/.subversion/servers -COPY open-jdk-source-file-location /open-jdk-source-file-location EXPOSE 22 4403 WORKDIR /projects diff --git a/recipes/stack-base/debian-stretch/entrypoint.sh b/recipes/stack-base/debian-stretch/entrypoint.sh new file mode 100755 index 00000000..c9c31f24 --- /dev/null +++ b/recipes/stack-base/debian-stretch/entrypoint.sh @@ -0,0 +1,40 @@ +#!/bin/bash +# Copyright (c) 2012-2018 Red Hat, Inc. +# This program and the accompanying materials +# are made available under the terms of the Eclipse Public License v2.0 +# which is available at http://www.eclipse.org/legal/epl-2.0.html +# +# SPDX-License-Identifier: EPL-2.0 +# +# Contributors: +# Red Hat, Inc. - initial API and implementation + +set -e + +export USER_ID=$(id -u) +export GROUP_ID=$(id -g) + +if ! grep -Fq "${USER_ID}" /etc/passwd; then + # current user is an arbitrary + # user (its uid is not in the + # container /etc/passwd). Let's fix that + cat ${HOME}/passwd.template | \ + sed "s/\${USER_ID}/${USER_ID}/g" | \ + sed "s/\${GROUP_ID}/${GROUP_ID}/g" | \ + sed "s/\${HOME}/\/home\/user/g" > /etc/passwd + + cat ${HOME}/group.template | \ + sed "s/\${USER_ID}/${USER_ID}/g" | \ + sed "s/\${GROUP_ID}/${GROUP_ID}/g" | \ + sed "s/\${HOME}/\/home\/user/g" > /etc/group +fi + +if test "${USER_ID}" = 0; then + # current user is root + /usr/sbin/sshd -D & +elif sudo -n true > /dev/null 2>&1; then + # current user is a suoder + sudo /usr/sbin/sshd -D & +fi + +exec "$@"