Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add devfile for dashboard #12757

Merged
merged 2 commits into from
Mar 1, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions dashboard/.devfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
specVersion: 0.0.1
name: dashboard-in-che
projects:
- name: che
source:
type: git
location: 'https://github.com/eclipse/che.git'
tools:
- name: theia-editor
type: cheEditor
id: org.eclipse.che.editor.theia:master
- name: exec-plugin
type: chePlugin
id: che-machine-exec-plugin:0.0.1
- name: dash-dev
type: dockerimage
image: 'eclipse/che-dashboard-dev:nightly'
endpoints:
- name: dashboard-dev-server
port: 3000
attributes:
path: /
protocol: http
public: "true"
mountSources: true
memoryLimit: 3Gi
commands:
- name: dashboard_build
actions:
- type: exec
tool: dash-dev
command: cd /projects/che/dashboard && yarn
workdir: /projects/che/dashboard
- name: dashboard_test
actions:
- type: exec
tool: dash-dev
command: cd /projects/che/dashboard && yarn test
workdir: /projects/che/dashboard
- name: dashboard_dev_server
actions:
- type: exec
tool: dash-dev
command: cd /projects/che/dashboard && node_modules/.bin/gulp serve --server=${CHE_API_EXTERNAL%????}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

%???? is the correct syntax ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, its in POSIX spec, see https://unix.stackexchange.com/a/259042

workdir: /projects/che/dashboard
23 changes: 23 additions & 0 deletions dockerfiles/dashboard-dev/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# 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 node:8.15.0

RUN apt-get update && \
apt-get install -y git \
&& apt-get -y clean \
&& rm -rf /var/lib/apt/lists/* \
&& echo fs.inotify.max_user_watches=524288 | tee -a /etc/sysctl.conf

WORKDIR "/projects"

ADD src/entrypoint.sh /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
CMD tail -f /dev/null
1 change: 1 addition & 0 deletions dockerfiles/dashboard-dev/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Docker file for dashboard dev file
15 changes: 15 additions & 0 deletions dockerfiles/dashboard-dev/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash
#
# 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
#

base_dir=$(cd "$(dirname "$0")"; pwd)
. "${base_dir}"/../build.include

init --name:dashboard-dev "$@"
build
29 changes: 29 additions & 0 deletions dockerfiles/dashboard-dev/src/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/bin/bash
#
# 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
#

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" > /etc/passwd

cat ${HOME}/.group.template | \
sed "s/\${USER_ID}/${USER_ID}/g" | \
sed "s/\${GROUP_ID}/${GROUP_ID}/g" > /etc/group
fi

exec "$@"