Recently, I was told that it was getting harder to write sequences with the gui drawing tool while I was working, so I decided to code it with PlantUML. At that time, there were some people who could build the environment smoothly and some who couldn't, so I wondered if it would be easy to build the environment with docker. The files written in the article are published on Github.
It is a prerequisite machine environment
--You can use docker --docker-compose can be used --VSCode is installed
The Docker image of PlantUML Server has been released, so I will use that. Change the VS Code extension settings to render using the PlantUML Server started locally.
It is troublesome to specify the port every time and `` docker run```, and I want to make post-processing easy, so I will make it possible to start and end with docker-compose. Create an appropriate directory and place the following
docker-compose.yml` file.
docker-compose.yml
version: '3'
services:
plantuml-server:
image: plantuml/plantuml-server
container_name: plantuml-local-server
ports:
- "8080:8080"
--Install extension PlantUML
--Set the following from the Extension settings
of the installed PlantUML
That's all for the settings.
When you want to draw a diagram with plantuml, move to the directory where docker-compose.yml
is placed and then start plantuml-server as follows.
$ docker-compose up -d
Create a pu file with VS Code. The location of the file is arbitrary.
sample.pu
@startuml sample
alice -> Bob: Hello, Bob!
alice <-- Bob: Hello, Alice!
@enduml
Open the VS Code command palette (ctrl + shift + p for windows command + shift + p for mac)
Select PlantUML: Preview Current Diagram
to see the preview. If you edit the file as it is, the preview will be updated as well.
When you finish
$ docker-compose down
Is OK.
Easy to build UML explosive preview environment with Visual Studio Code + PlantUML Server on Docker
Recommended Posts