Tech Blog

IntelliJ IDEA をリモート環境で快適に使う

Cover Image for IntelliJ IDEA をリモート環境で快適に使う

JetBrains Space, Gitpod, Google Cloud Workstations で利用できるリモート開発環境を自前で構築して試してみる

Requirements

TL;DR

  1. Docker 環境を用意する
  # Dockerfile
+ FROM gradle:7.5.1-jdk17
+
+ ENV LC_ALL C.UTF-8
+
+ RUN apt-get update \
+     && apt-get install -y --no-install-recommends openssh-server \
+     && rm -rf /var/lib/apt/lists/* \
+     && mkdir -p /run/sshd \
+     && sed -i "s/#PermitRootLogin prohibit-password/PermitRootLogin yes/" /etc/ssh/sshd_config \
+     && sed -i "s/#PermitEmptyPasswords no/PermitEmptyPasswords yes/" /etc/ssh/sshd_config \
+     && sed -i "s/UsePAM yes/UsePAM no/" /etc/ssh/sshd_config
+
+ WORKDIR /home/gradle/src
+
+ EXPOSE 22 8080
+
+ CMD ["/usr/sbin/sshd", "-D"]
+
  # docker-compose.yml
+ version: '3.8'
+
+ volumes:
+   app-cache:
+
+     null
+ services:
+   app:
+     build:
+       context: .
+       dockerfile: Dockerfile
  # The Linux platform has any recent Linux AMD64 distribution such as Ubuntu 16.
  # 04+, RHEL/Centos 7+, and so on. There is no arm64 support yet. We recommend u
  # sing machines with 2+ cores, 4GB+ of RAM, and 5GB+ of disk space.
+     platform: linux/x86_64
+     volumes:
+       - .:/home/gradle/src:cached
+       - app-cache:/home/gradle/.gradle
+
+     ports:
+       - '22:22'
+       - "8080:8080"
+
docker-compose up -d
  1. IntelliJ IDEA を起動, Remote Development, SSH Connection を選択

Run the IDE Remotely

  1. Username, Host を入力し Check Connection and Continue を選択

Connect to SSH

  1. IDE version, Project directory を選択し Download IDE and Connect を選択

Choose IDE and Project

  1. IDE Backend のダウンロードとインストールが終わるのを待つ

Downloading IDE Backend on Remote

  1. Enjoy coding!

Connected

参考にしたページ