Skip to content
This repository has been archived by the owner on Apr 4, 2023. It is now read-only.

Commit

Permalink
Move sidecar definitions into the plugin registry (part I) (#676)
Browse files Browse the repository at this point in the history
* Move sidecar definitions into the plugin registry

Part 1 of the migration. I am doing it in parts because doing it all at once
will likely cause a build timeout upon pushing.

Part of eclipse-che/che#18217

Signed-off-by: Eric Williams <ericwill@redhat.com>

* Handle java and java8 separately

Signed-off-by: Eric Williams <ericwill@redhat.com>
  • Loading branch information
ericwill authored Nov 9, 2020
1 parent 6245f56 commit c939ba4
Show file tree
Hide file tree
Showing 22 changed files with 532 additions and 0 deletions.
39 changes: 39 additions & 0 deletions sidecars/dependency-analytics/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Copyright (c) 2020 Red Hat, Inc.
# This program and the accompanying materials are made
# available under the terms of the Eclipse Public License 2.0
# which is available at https://www.eclipse.org/legal/epl-2.0/
#
# SPDX-License-Identifier: EPL-2.0
#
# Contributors:
# Red Hat, Inc. - initial API and implementation

FROM node:12.18.3-alpine
# npm comes from the base image, install maven and python3.
RUN apk --update --no-cache add openjdk8 procps nss maven python3 && [[ ! -e /usr/bin/python ]] && \
ln -sf /usr/bin/python3 /usr/bin/python
ENV JAVA_HOME /usr/lib/jvm/default-jvm/

ENV MAVEN_VERSION 3.5.4
ENV MAVEN_HOME /usr/lib/mvn
ENV PATH $MAVEN_HOME/bin:$PATH
ENV HOME=/home/theia

RUN mkdir /projects ${HOME} && \
# Change permissions to let any arbitrary user
for f in "${HOME}" "/etc/passwd" "/projects"; do \
echo "Changing permissions on ${f}" && chgrp -R 0 ${f} && \
chmod -R g+rwX ${f}; \
done

RUN wget http://archive.apache.org/dist/maven/maven-3/$MAVEN_VERSION/binaries/apache-maven-$MAVEN_VERSION-bin.tar.gz && \
tar -zxvf apache-maven-$MAVEN_VERSION-bin.tar.gz && \
rm apache-maven-$MAVEN_VERSION-bin.tar.gz && \
mv apache-maven-$MAVEN_VERSION /usr/lib/mvn

WORKDIR /projects

ADD etc/entrypoint.sh /entrypoint.sh

ENTRYPOINT [ "/entrypoint.sh" ]
CMD ${PLUGIN_REMOTE_ENDPOINT_EXECUTABLE}
1 change: 1 addition & 0 deletions sidecars/dependency-analytics/PLATFORMS
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
linux/amd64,linux/ppc64le,linux/s390x,linux/arm64
30 changes: 30 additions & 0 deletions sidecars/dependency-analytics/etc/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/bin/sh
#
# Copyright (c) 2018-2020 Red Hat, Inc.
# This program and the accompanying materials are made
# available under the terms of the Eclipse Public License 2.0
# which is available at https://www.eclipse.org/legal/epl-2.0/
#
# SPDX-License-Identifier: EPL-2.0
#
# Contributors:
# Red Hat, Inc. - initial API and implementation
#

set -e

USER_ID=$(id -u)
GROUP_ID=$(id -g)
export USER_ID
export GROUP_ID

if ! whoami >/dev/null 2>&1; then
echo "${USER_NAME:-user}:x:${USER_ID}:0:${USER_NAME:-user} user:${HOME}:/bin/sh" >> /etc/passwd
fi

# Grant access to projects volume in case of non root user with sudo rights
if [ "${USER_ID}" -ne 0 ] && command -v sudo >/dev/null 2>&1 && sudo -n true > /dev/null 2>&1; then
sudo chown "${USER_ID}:${GROUP_ID}" /projects
fi

exec "$@"
33 changes: 33 additions & 0 deletions sidecars/dotnet/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Copyright (c) 2020 Red Hat, Inc.
# This program and the accompanying materials are made
# available under the terms of the Eclipse Public License 2.0
# which is available at https://www.eclipse.org/legal/epl-2.0/
#
# SPDX-License-Identifier: EPL-2.0
#
# Contributors:
# Red Hat, Inc. - initial API and implementation

FROM mcr.microsoft.com/dotnet/core/sdk:3.1.301-buster

ENV HOME=/home/theia

RUN mkdir /projects ${HOME} && \
# Change permissions to let any arbitrary user
for f in "${HOME}" "/etc/passwd" "/projects"; do \
echo "Changing permissions on ${f}" && chgrp -R 0 ${f} && \
chmod -R g+rwX ${f}; \
done

RUN mkdir ${HOME}/.dotnet && chmod -R 777 ${HOME}/.dotnet \
&& mkdir /usr/share/dotnet/sdk/NuGetFallbackFolder && chmod 777 /usr/share/dotnet/sdk/NuGetFallbackFolder \
&& mkdir ${HOME}/.nuget && chmod -R 777 ${HOME}/.nuget \
&& mkdir ${HOME}/.templateengine && chmod -R 777 ${HOME}/.templateengine \
&& chmod -R 777 ${HOME}

WORKDIR /projects

ADD etc/entrypoint.sh /entrypoint.sh

ENTRYPOINT [ "/entrypoint.sh" ]
CMD ${PLUGIN_REMOTE_ENDPOINT_EXECUTABLE}
1 change: 1 addition & 0 deletions sidecars/dotnet/PLATFORMS
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
linux/amd64
30 changes: 30 additions & 0 deletions sidecars/dotnet/etc/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/bin/sh
#
# Copyright (c) 2018-2020 Red Hat, Inc.
# This program and the accompanying materials are made
# available under the terms of the Eclipse Public License 2.0
# which is available at https://www.eclipse.org/legal/epl-2.0/
#
# SPDX-License-Identifier: EPL-2.0
#
# Contributors:
# Red Hat, Inc. - initial API and implementation
#

set -e

USER_ID=$(id -u)
GROUP_ID=$(id -g)
export USER_ID
export GROUP_ID

if ! whoami >/dev/null 2>&1; then
echo "${USER_NAME:-user}:x:${USER_ID}:0:${USER_NAME:-user} user:${HOME}:/bin/sh" >> /etc/passwd
fi

# Grant access to projects volume in case of non root user with sudo rights
if [ "${USER_ID}" -ne 0 ] && command -v sudo >/dev/null 2>&1 && sudo -n true > /dev/null 2>&1; then
sudo chown "${USER_ID}:${GROUP_ID}" /projects
fi

exec "$@"
58 changes: 58 additions & 0 deletions sidecars/go/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# Copyright (c) 2019 Red Hat, Inc.
# This program and the accompanying materials are made
# available under the terms of the Eclipse Public License 2.0
# which is available at https://www.eclipse.org/legal/epl-2.0/
#
# SPDX-License-Identifier: EPL-2.0
#
# Contributors:
# Red Hat, Inc. - initial API and implementation

FROM golang:1.14.9-stretch

ENV HOME=/home/theia

RUN mkdir /projects ${HOME} && \
# Change permissions to let any arbitrary user
for f in "${HOME}" "/etc/passwd" "/projects"; do \
echo "Changing permissions on ${f}" && chgrp -R 0 ${f} && \
chmod -R g+rwX ${f}; \
done

RUN set -e -x && \
go get -u -v github.com/ramya-rao-a/go-outline && \
go get -u -v github.com/acroca/go-symbols && \
go get -u -v golang.org/x/tools/cmd/godoc && \
go get -u -v github.com/zmb3/gogetdoc && \
go get -u -v golang.org/x/lint/golint && \
go get -u -v github.com/fatih/gomodifytags && \
go get -u -v golang.org/x/tools/cmd/gorename && \
go get -u -v github.com/sqs/goreturns && \
go get -u -v golang.org/x/tools/cmd/goimports && \
go get -u -v github.com/cweill/gotests/... && \
go get -u -v golang.org/x/tools/cmd/guru && \
go get -u -v github.com/josharian/impl && \
go get -u -v github.com/haya14busa/goplay/cmd/goplay && \
go get -u -v github.com/davidrjenni/reftools/cmd/fillstruct && \
go get -u -v github.com/go-delve/delve/cmd/dlv && \
go get -u -v github.com/rogpeppe/godef && \
go get -u -v github.com/uudashr/gopkgs/v2/cmd/gopkgs && \
go get -u -v golang.org/x/tools/cmd/gotype && \
go get -u -v github.com/mdempsky/gocode && \
go get -u -v github.com/stamblerre/gocode && \
GO111MODULE=on go get -v golang.org/x/tools/gopls@master golang.org/x/tools@master && \
go build -o /go/bin/gocode-gomod github.com/stamblerre/gocode && \
chmod -R 777 /go && \
mkdir -p /.cache && chmod -R 777 /.cache && \
mkdir -p /usr/local/go && chmod -R 777 /usr/local/go && \
cd /usr/local/go && wget -O- -nv https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v1.22.2

ENV GOPATH /go
ENV GOCACHE /.cache
ENV GOROOT /usr/local/go
ENV GO111MODULE on

ADD etc/entrypoint.sh /entrypoint.sh

ENTRYPOINT [ "/entrypoint.sh" ]
CMD ${PLUGIN_REMOTE_ENDPOINT_EXECUTABLE}
1 change: 1 addition & 0 deletions sidecars/go/PLATFORMS
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
linux/amd64
30 changes: 30 additions & 0 deletions sidecars/go/etc/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/bin/sh
#
# Copyright (c) 2018-2020 Red Hat, Inc.
# This program and the accompanying materials are made
# available under the terms of the Eclipse Public License 2.0
# which is available at https://www.eclipse.org/legal/epl-2.0/
#
# SPDX-License-Identifier: EPL-2.0
#
# Contributors:
# Red Hat, Inc. - initial API and implementation
#

set -e

USER_ID=$(id -u)
GROUP_ID=$(id -g)
export USER_ID
export GROUP_ID

if ! whoami >/dev/null 2>&1; then
echo "${USER_NAME:-user}:x:${USER_ID}:0:${USER_NAME:-user} user:${HOME}:/bin/sh" >> /etc/passwd
fi

# Grant access to projects volume in case of non root user with sudo rights
if [ "${USER_ID}" -ne 0 ] && command -v sudo >/dev/null 2>&1 && sudo -n true > /dev/null 2>&1; then
sudo chown "${USER_ID}:${GROUP_ID}" /projects
fi

exec "$@"
25 changes: 25 additions & 0 deletions sidecars/node/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Copyright (c) 2020 Red Hat, Inc.
# This program and the accompanying materials are made
# available under the terms of the Eclipse Public License 2.0
# which is available at https://www.eclipse.org/legal/epl-2.0/
#
# SPDX-License-Identifier: EPL-2.0
#
# Contributors:
# Red Hat, Inc. - initial API and implementation

FROM node:12.18.3-alpine

ENV HOME=/home/theia

RUN mkdir /projects ${HOME} && \
# Change permissions to let any arbitrary user
for f in "${HOME}" "/etc/passwd" "/projects"; do \
echo "Changing permissions on ${f}" && chgrp -R 0 ${f} && \
chmod -R g+rwX ${f}; \
done

ADD etc/entrypoint.sh /entrypoint.sh

ENTRYPOINT [ "/entrypoint.sh" ]
CMD ${PLUGIN_REMOTE_ENDPOINT_EXECUTABLE}
1 change: 1 addition & 0 deletions sidecars/node/PLATFORMS
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
linux/amd64,linux/ppc64le,linux/s390x,linux/arm64
30 changes: 30 additions & 0 deletions sidecars/node/etc/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/bin/sh
#
# Copyright (c) 2018-2020 Red Hat, Inc.
# This program and the accompanying materials are made
# available under the terms of the Eclipse Public License 2.0
# which is available at https://www.eclipse.org/legal/epl-2.0/
#
# SPDX-License-Identifier: EPL-2.0
#
# Contributors:
# Red Hat, Inc. - initial API and implementation
#

set -e

USER_ID=$(id -u)
GROUP_ID=$(id -g)
export USER_ID
export GROUP_ID

if ! whoami >/dev/null 2>&1; then
echo "${USER_NAME:-user}:x:${USER_ID}:0:${USER_NAME:-user} user:${HOME}:/bin/sh" >> /etc/passwd
fi

# Grant access to projects volume in case of non root user with sudo rights
if [ "${USER_ID}" -ne 0 ] && command -v sudo >/dev/null 2>&1 && sudo -n true > /dev/null 2>&1; then
sudo chown "${USER_ID}:${GROUP_ID}" /projects
fi

exec "$@"
40 changes: 40 additions & 0 deletions sidecars/php/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Copyright (c) 2020 Red Hat, Inc.
# This program and the accompanying materials are made
# available under the terms of the Eclipse Public License 2.0
# which is available at https://www.eclipse.org/legal/epl-2.0/
#
# SPDX-License-Identifier: EPL-2.0
#
# Contributors:
# Red Hat, Inc. - initial API and implementation

FROM alpine:3.12.1

RUN apk --update --no-cache add \
ca-certificates \
php7 php7-fpm php7-opcache \
php7-gd php7-mysqli php7-zlib php7-curl \
&& apk --update --no-cache add \
php7-xdebug --repository http://dl-3.alpinelinux.org/alpine/edge/testing/ \
&& echo "zend_extension=$(find /usr/lib/php7/modules/ -name xdebug.so)" > /etc/php7/php.ini \
&& echo "xdebug.coverage_enable=0" >> /etc/php7/php.ini \
&& echo "xdebug.remote_enable=1" >> /etc/php7/php.ini \
&& echo "xdebug.remote_connect_back=1" >> /etc/php7/php.ini \
&& echo "xdebug.remote_log=/tmp/xdebug.log" >> /etc/php7/php.ini \
&& echo "xdebug.remote_autostart=true" >> /etc/php7/php.ini

ENV HOME=/home/theia

RUN mkdir /projects ${HOME} && \
# Change permissions to let any arbitrary user
for f in "${HOME}" "/etc/passwd" "/projects"; do \
echo "Changing permissions on ${f}" && chgrp -R 0 ${f} && \
chmod -R g+rwX ${f}; \
done

WORKDIR /projects

ADD etc/entrypoint.sh /entrypoint.sh

ENTRYPOINT [ "/entrypoint.sh" ]
CMD ${PLUGIN_REMOTE_ENDPOINT_EXECUTABLE}
1 change: 1 addition & 0 deletions sidecars/php/PLATFORMS
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
linux/amd64,linux/ppc64le,linux/s390x,linux/arm64
30 changes: 30 additions & 0 deletions sidecars/php/etc/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/bin/sh
#
# Copyright (c) 2018-2020 Red Hat, Inc.
# This program and the accompanying materials are made
# available under the terms of the Eclipse Public License 2.0
# which is available at https://www.eclipse.org/legal/epl-2.0/
#
# SPDX-License-Identifier: EPL-2.0
#
# Contributors:
# Red Hat, Inc. - initial API and implementation
#

set -e

USER_ID=$(id -u)
GROUP_ID=$(id -g)
export USER_ID
export GROUP_ID

if ! whoami >/dev/null 2>&1; then
echo "${USER_NAME:-user}:x:${USER_ID}:0:${USER_NAME:-user} user:${HOME}:/bin/sh" >> /etc/passwd
fi

# Grant access to projects volume in case of non root user with sudo rights
if [ "${USER_ID}" -ne 0 ] && command -v sudo >/dev/null 2>&1 && sudo -n true > /dev/null 2>&1; then
sudo chown "${USER_ID}:${GROUP_ID}" /projects
fi

exec "$@"
Loading

0 comments on commit c939ba4

Please sign in to comment.