Base image to run desktop application inside a container in Eclipse Che.
This repository is a starting point to build an image with custom desktop application that runs in a container inside Eclipse Che.
The image itself works in cooperation with devfile as image for components that has type cheEditor
.
This is the flow of how you may build and test base editor image.
- Clone the repo
git clone https://github.com/che-incubator/custom-native-editor-base-image && cd custom-native-editor-base-image
- Build image with docker
docker build -t custom-native-editor-base-image .
- Run built container
docker run -it -p 8080:8080 custom-native-editor-base-image
- Navigate to run container
http://localhost:8080/vnc.html?resize=remote&autoconnect=1
Below provided an example how to use base editor image to create custom editor image based on the vim
editor.
Source code of example provided in /example
directory.
- Create file
Dockerfile
FROM custom-native-editor-base-image:latest
# Set up root user to have an ability to install necessary packages
USER root
# Perform package install and copy supervisor configuration
RUN yum install -y vim && yum clean all
COPY --chown=0:0 vim.conf /etc/supervisord.d/vim.conf
# Setup correct user
USER 1001
- Create file
vim.conf
[program:vim]
command=xterm -display :0 -e /bin/bash -l -c "vim"
stdout_logfile=/tmp/vim.log
stderr_logfile=/tmp/vim.log
user=user
environment=DISPLAY=":0"
autorestart=true
priority=999
- Build an image
docker build -t vim-custom-editor .
- Run image
docker run -it -p 8080:8080 vim-custom-editor
- Navigate to run container
http://localhost:8080/vnc.html?resize=remote&autoconnect=1
- Push image to public registry
docker tag vim-custom-editor:latest <username>/vim-custom-editor:latest
docker push <username>/vim-custom-editor:latest
- Create file
meta.yaml
and upload it to have a public access to it, e.g. to https://gist.github.com/
apiVersion: v2
publisher: <username>
name: vim-NOVNC
version: 1.0
type: Che Editor
displayName: Vim
title: Vim (in browser using noVNC) as editor for Eclipse Che
description: Vim running on the Web with noVNC
icon: https://raw.githubusercontent.com/vim/vim/master/runtime/vimlogo.gif
category: Editor
repository: https://github.com/che-incubator/custom-native-editor-base-image
firstPublicationDate: "2020-11-03"
spec:
endpoints:
- name: "dirigible"
public: true
targetPort: 8080
attributes:
protocol: http
type: ide
path: /vnc.html?resize=remote&autoconnect=true&reconnect=true
containers:
- name: vim-novnc
image: "<username>/vim-custom-editor:latest"
mountSources: true
ports:
- exposedPort: 8080
memoryLimit: "1024M"
- Create file
devfile.yaml
metadata:
name: vim-workspace
components:
- type: cheEditor
reference: '<url for meta.yaml goes here>'
alias: theia-editor
apiVersion: 1.0.0
- Navigate to https://che.openshift.io/ and create a workspace from current
devfile.yaml
See the open issues for a list of proposed features (and known issues).
Distributed under the Eclipse Public License - v 2.0 license. See LICENSE
for more information.