🤖

Dev ContainerでTauriの開発環境を作る

2024/10/16に公開

以下のDev Containerの設定ファイルを使う。ポイントは、Desktop (Lightweight)を使ってWebブラウザ上でUbuntu画面を表示し、その画面上でTauriのGUIを表示する。

devcontainer.json
{
	"name": "Ubuntu",
	"image": "mcr.microsoft.com/devcontainers/base:jammy",
	"features": {
		"ghcr.io/devcontainers/features/desktop-lite:1": {
			"version": "latest",
			"noVncVersion": "1.2.0",
			"password": "vscode",
			"webPort": "6080",
			"vncPort": "5901"
		},
		"ghcr.io/devcontainers/features/node:1": {
			"version": "18"
		},
		"ghcr.io/devcontainers/features/rust:1": {
			"version": "1.79"
		}
	},
	"postCreateCommand": "/bin/sh ./.devcontainer/setup.sh"
}

setup.shの中身は公式ドキュメント通り。

https://tauri.app/start/prerequisites/#linux

setup.sh
sudo apt update -y
sudo apt install -y libwebkit2gtk-4.1-dev \
  build-essential \
  curl \
  wget \
  file \
  libxdo-dev \
  libssl-dev \
  libayatana-appindicator3-dev \
  librsvg2-dev

Discussion