(For myself) Build an IDE that you can touch from a browser with docker (trial)

Introduction

I didn't know until then, but in this article I became interested in WebIDE after learning about the existence of jupyterlab. I'm going to give it a try with docker.

environment

We will do it in the following environment.

Advance preparation

python


mkdir web-ide
mkdir web-ide/cloud9
mkdir web-ide/jupyter-lab
mkdir web-ide/eclipse-che
mkdir web-ide/code-server
mkdir web-ide/eclipse-theia

eclipse-theia I learned for the first time recently that there is something called eclipse-thiea as a counter to vscode. It seems to be used for Gitpod and used by well-known companies, so you can expect quite a lot. Take a look at Official Github and try to build it quickly.

python


cd web-ide/eclipse-theia

touch docker-compose.yml
# docker-compose.Edit yml
gedit docker-compose.yml

mkdir project

docker-compose looks like this, for the time being, let's make it an image with everything.

docker-compose.yml


version: '2.2'

services:
  eclipse-theia:
    restart: always
    image: theiaide/theia-full #Image with all
    init: true
    ports:
      - 50003:3000
    volumes:
      - ./project:/home/project/:cached

start up. docker-compose up -d

Try accessing it from your browser. image.png

Create test.py. image.png

I'm told that I don't have Linter, so I'll install it. image.png

The following command was hit.

python


/usr/bin/python3.8 -m pip install -U pylint --u Collecting pylint

After that, when I try to run it, it says that there is no "Debug Configuration" without launch.json. Of course, select "Python File" here. image.png

The following json is created.

json:.theid/launch.json


{
  // Use IntelliSense to learn about possible attributes.
  // Hover to view descriptions of existing attributes.
  "version": "0.2.0",
  "configurations": [
    {
      "name": "Python: Current File",
      "type": "python",
      "request": "launch",
      "program": "${file}",
      "console": "integratedTerminal"
    }
  ]
}

If you set a breakpoint and try to execute it image.png It seems that you can debug properly.

What about security like other Cloud9 and code-server? I thought If you use it on the cloud, do you use it with a certificate via nginx? I can't read it properly because it's in English, but probably. The reference URL is as follows. How To Set Up the Eclipse Theia Cloud IDE Platform on Ubuntu 18.04 [Quickstart] How To Set Up the Eclipse Theia Cloud IDE Platform on Ubuntu 18.04 [Quickstart] How To Set Up the Eclipse Theia Cloud IDE Platform on Ubuntu 18.04 I will try it at another time.

Cloud9

When I was looking for it on docker-hub, there were quite a few new and many pulls. Use it.

python


cd web-ide/cloud9

touch docker-compose.yml
# docker-compose.Edit yml
gedit docker-compose.yml

mkdir code
mkdir docker.sock

docker-compose.yml should look like this.

docker-compose.yml


version: "2.1"
services:
  cloud9:
    image: linuxserver/cloud9:python
    container_name: cloud9
    environment:
      - PUID=1000
      - PGID=1000
      - TZ=Asia/Tokyo
      - GITURL=https://github.com/linuxserver/docker-cloud9.git #optional
      - USERNAME=user #optional
      - PASSWORD=password #optional
    volumes:
      - ./code:/code #optional
      - ./docker.sock:/var/run/docker.sock #optional
    ports:
      - 10000:8000
    restart: unless-stopped

start up. docker-compose up -d

Try accessing it from your browser. image.png I was able to access it by entering the user and password set in yml.

I used python as the tag, but does Runner contain this much? it seems like. image.png

I was able to run it from bash, but for some reason I couldn't run python from Run. .. .. image.png

Is there something wrong with the Runner settings? It's a trial for the time being, so Yoshi! will do. image.png

Postscript

If you add Runner and change the cmd part as follows, you can also run with python.

python3.run


// This file overrides the built-in Python runner
// For more information see http://docs.c9.io:8080/#!/api/run-method-run
{
  "cmd": [
--- "$python",
+++ "python3",
    "$file",
    "$args"
  ],
  "selector": "^.*\\.(python|py)$",
  "env": {
    "PYTHONPATH": "$python_path"
  }
}

I was able to run C ++. image.png

Reference URL: linuxserver/cloud9 Prepare the fastest and lightest IDE environment with docker + alpine + cloud9 Create an online IDE for free

code-server

cd /web-ide/code-server
mkdir projects
mkdir code-server
touch Dockerfile
touch docker-compose.yml

The Dockerfile and docker-compose.yml are as follows. I'm installing python3 easily.

Dockerfile


FROM codercom/code-server:latest

USER root

RUN apt-get update && apt-get install -y \
	python3

USER coder

docker-compose.yml


version: "3"
services:
  code:
    build:
      context: .
      dockerfile: Dockerfile
    restart: always
    environment:
      PASSWORD: password
    ports:
      - 30001:8080
    volumes:
      - ./projects:/home/coder/project
      - ./code-server:/home/coder/.local/share/code-server

Try accessing it from your browser. image.png I was able to access it by entering the password set in yml.

Run python from the terminal.

python3 test.py

image.png

python worked, but I'm not sure how to debug. .. .. Like normal vscode, it seems possible with lanuch.json I'm not sure about the settings. If you can use it so far on a browser basis without a debugger, you can use it for a little development at all.

The strongest mobile development environment created with Docker Thorn road of code-server construction and its shortcut A story about trying to run Docker + Nginx + code-server on my home server codercom/code-server Build a CODE SERVER for VISUAL STUDIO CODE and access it from a browser

Jupyter Lab Refer to the following article. If you're trying a language, this is definitely your choice. I'm not sure about application development, but maybe I can do my best. I made a Docker image of Jupyter Lab with 17 languages HeRoMo/jupyter-langs (For myself) allow jupyterlab to run different languages ​​and C # mototoke/jupyter-langs

eclipse-che I will omit it because I could not build it well. sorrow.

General comment

I've only touched it a little, but I like cloud9 as a personal feeling of operation. Since code-server is almost vscode, it's the same as usual, but I felt that the intellisense of the terminal didn't work. I didn't mention eclisep-che, but it seems that the template of the project can be used, so it looks pretty good. In any case, it's just a wonderful word to be able to set up one server and develop with just a browser. I decided to use it if I had a chance next time.

Postscript: For now, eclipse-theia, which seems to be able to debug, may be the best. It seems that it is compatible with vscode extension, so I got the impression that it seems to be quite easy to use. For now, if you want to develop python apps on web-ide, you should choose eclipse-thiea.

Recommended Posts

(For myself) Build an IDE that you can touch from a browser with docker (trial)
(For myself) Build gitlab with ubuntu18.04 + docker for home (Note)
Build an Android image for Orange Pi 4 with Docker
How to solve the problem that you can not pull image from docker hub with Minikube
Build a SPA for Laravel 6.2 / Vue.js / Nginx / Mysql / Redis with Docker
(For myself) Try creating a C # environment with docker + code-server, cloud9
Build a development environment for Django + MySQL + nginx with Docker Compose
Build a Node.js environment with Docker
Command line that can create a directory structure for building a Laravel environment with Docker in one shot
Build a web application development environment that uses Java, MySQL, and Redis with Docker CE for Windows
# 1 [Beginner] Create a web application (website) with Eclipse from knowledge 0. "Let's build an environment for creating web applications"
Build a local development environment for Rails tutorials with Docker (Rails 6 + PostgreSQL + Webpack)
Build a PureScript development environment with Docker
Create a MySQL environment with Docker from 0-> 1
Build a WAS execution environment from Docker
Build a Wordpress development environment with Docker
Build an environment with Docker on AWS
When is it said that you can use try with a Swift error?
A ruby ​​script that creates an rsa private key that can be used with OpenSSL from any two prime numbers
Graph the sensor information of Raspberry Pi and prepare an environment that can be checked with a web browser
Build a Laravel / Docker environment with VSCode devcontainer
Build a WordPress development environment quickly with Docker
A memo for myself that object-oriented is something
Build a development environment for Docker, java, vscode
[Rails] How to build an environment with Docker
[First team development ②] Build an environment with Docker
With RSA, you can create a public key that includes your favorite character string
A story that got stuck with an error during migration in docker PHP laravel
Be careful when deleting multiple elements from an array etc. with a for statement
Build a local development environment for Open Distro for Elasticsearch with multiple nodes using Docker
How to quit Docker for Mac and build a Docker development environment with Ubuntu + Vagrant
Compiled kotlin with cli with docker and created an environment that can be executed with java