JetBrains Space, Gitpod, Google Cloud Workstations で利用できるリモート開発環境を自前で構築して試してみる
Requirements
TL;DR
- 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
- IntelliJ IDEA を起動, Remote Development, SSH Connection を選択
- Username, Host を入力し Check Connection and Continue を選択
- IDE version, Project directory を選択し Download IDE and Connect を選択
- IDE Backend のダウンロードとインストールが終わるのを待つ
- Enjoy coding!