3
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

VS CodeのRemote-ContainersでPlant UMLのコンテナ環境を作る

Posted at

やりたいこと

UMLのサーバーをDockerで構築して,VS Codeの拡張機能を使って編集したい!Remote-Containersを使って簡単に環境構築出来たらうれしいな!

環境

  • Visual Studio Code
    • 拡張機能Remote-Containersを入れておく
    • 拡張機能Plant UMLはコンテナの中に入るときにコンテナ内に導入される
  • Docker

必要なファイルの用意

ディレクトリ構成

(root)
│
├─ test.pu
│
└─.devcontainer
        devcontainer.json
        docker-compose.yml

環境設定のファイルの中身

devcontainer.json
{
    "name": "dev container",
    "dockerComposeFile": "docker-compose.yml",
    "service": "plantuml-server",
    "workspaceFolder": "/workspace/",
    "extensions": [
        "jebbs.plantuml",
    ]
}
docker-compose.yml
version: '3'
services:
  plantuml-server:
    image: plantuml/plantuml-server
    container_name: plantuml-container
    ports:
      - "8080:8080"
    volumes:
      - ..:/workspace:cached

テスト用のUMLファイル

test.pu
@startuml sample
alice -> Bob: Hello, John!
alice <-- Bob: Hello, World!
@enduml

実行する

  1. コマンドパレットRemote-Containers: Rebuild and Reopen in containerからコンテナの中に入る
  2. エディタでtest.puを開く
  3. コマンドパレットPlantUML: Preview Current Diagramを実行
  4. プレビューが表示される
    sample.png

参考資料

3
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?