forked from eclipse-che/che-plugin-registry
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(ansible): Add a sidecar with Ansible tooling installed inside
related to eclipse-che/che#11877 Change-Id: Ifc1af877a797fd1b0043ed3574a5adac0e204e1d Signed-off-by: Florent Benoit <fbenoit@redhat.com>
- Loading branch information
Showing
3 changed files
with
58 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# 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 quay.io/ansible/toolset:3.4.0 | ||
|
||
ENV HOME=/home/theia | ||
|
||
RUN apt-get update && apt-get -y install ansible-lint && apt-get clean && apt-get -y autoremove && rm -rf /var/lib/apt/lists/* && \ | ||
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} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
linux/amd64 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#!/bin/sh | ||
# | ||
# 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 | ||
# | ||
|
||
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 "$@" |