diff --git a/.github/workflows/build-publish.yaml b/.github/workflows/build-publish.yaml index 7a0506b..1721ce2 100644 --- a/.github/workflows/build-publish.yaml +++ b/.github/workflows/build-publish.yaml @@ -1,5 +1,5 @@ # -# Copyright (c) 2019 Red Hat, Inc. +# 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/ @@ -12,7 +12,7 @@ name: Build and push container on: push: branches: - - '1.0.4' + - '1.0.9' jobs: build: diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..2c38e77 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,36 @@ +# 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 quay.io/buildah/stable:v1.11.3 + +ENV KUBECTL_VERSION v1.17.0 +ENV HELM_VERSION v3.0.2 +ENV HOME=/home/theia + +ADD etc/storage.conf $HOME/.config/containers/storage.conf + +RUN mkdir /projects && \ + # 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 && \ + # buildah login requires writing to /run + chgrp -R 0 /run && chmod -R g+rwX /run && \ + curl https://storage.googleapis.com/kubernetes-release/release/${KUBECTL_VERSION}/bin/linux/amd64/kubectl -o /usr/local/bin/kubectl && \ + chmod +x /usr/local/bin/kubectl && \ + curl -o- -L https://get.helm.sh/helm-${HELM_VERSION}-linux-amd64.tar.gz | tar xvz -C /usr/local/bin --strip 1 && \ + # 'which' utility is used by VS Code Kubernetes extension to find the binaries, e.g. 'kubectl' + dnf install -y which nodejs + +ADD etc/entrypoint.sh /entrypoint.sh + +ENTRYPOINT [ "/entrypoint.sh" ] +CMD ${PLUGIN_REMOTE_ENDPOINT_EXECUTABLE} diff --git a/etc/entrypoint.sh b/etc/entrypoint.sh new file mode 100755 index 0000000..0447e5d --- /dev/null +++ b/etc/entrypoint.sh @@ -0,0 +1,29 @@ +#!/bin/sh +# +# Copyright (c) 2018-2018 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 + +export USER_ID=$(id -u) +export GROUP_ID=$(id -g) + +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 "$@" + diff --git a/etc/storage.conf b/etc/storage.conf new file mode 100644 index 0000000..e731df6 --- /dev/null +++ b/etc/storage.conf @@ -0,0 +1,31 @@ +[storage] + driver = "overlay" + runroot = "/var/tmp/theia" + graphroot = "/home/theia/.local/share/containers/storage" + [storage.options] + size = "" + remap-uids = "" + remap-gids = "" + ignore_chown_errors = "true" + remap-user = "" + remap-group = "" + ostree_repo = "" + skip_mount_home = "" + mount_program = "/usr/bin/fuse-overlayfs" + mountopt = "" + [storage.options.thinpool] + autoextend_percent = "" + autoextend_threshold = "" + basesize = "" + blocksize = "" + directlvm_device = "" + directlvm_device_force = "" + fs = "" + log_level = "" + min_free_space = "" + mkfsarg = "" + mountopt = "" + use_deferred_deletion = "" + use_deferred_removal = "" + xfs_nospace_max_retries = "" +