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

Commit

Permalink
add plantUML sidecar (#863)
Browse files Browse the repository at this point in the history
* add plantUML sidecar

Signed-off-by: Esteban Mañaricua <emanaricua@gmail.com>

* remove unused debs

Signed-off-by: Esteban Mañaricua <emanaricua@gmail.com>

* fix dates

Signed-off-by: Esteban Mañaricua <emanaricua@gmail.com>
  • Loading branch information
gattytto committed Mar 1, 2021
1 parent 8dec90b commit 013807b
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 0 deletions.
30 changes: 30 additions & 0 deletions sidecars/plantuml/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Copyright (c) 2021 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 plantuml/plantuml-server

ENV TMPDIR=/tmp
ENV HOME=/home/theia

USER root

RUN mkdir /projects && mkdir -p /home/theia && \
# 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 && \
chgrp -R 0 /run && chmod -R g+rwX /run && \
chgrp -R 0 /var/lib/jetty && chmod -R g+rwX /var/lib/jetty && \
apt update && apt install -y graphviz

ADD etc/entrypoint.sh /entrypoint.sh
ENTRYPOINT [ "/entrypoint.sh" ]

CMD ${PLUGIN_REMOTE_ENDPOINT_EXECUTABLE}
1 change: 1 addition & 0 deletions sidecars/plantuml/PLATFORMS
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
linux/amd64
31 changes: 31 additions & 0 deletions sidecars/plantuml/etc/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/bin/sh
#
# Copyright (c) 2018-2021 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
set -x

USER_ID=$(id -u)
export USER_ID
GROUP_ID=$(id -g)
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 "$@"

0 comments on commit 013807b

Please sign in to comment.