Skip to content

Commit

Permalink
feat: initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastienfi committed Dec 28, 2023
1 parent 40f7f97 commit 6fcd3fa
Show file tree
Hide file tree
Showing 3 changed files with 96 additions and 2 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/docker-build-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Build and Publish Docker Image

on:
push:
branches:
- main

jobs:
docker:
runs-on: ubuntu-latest

steps:
- name: Check out the repo
uses: actions/checkout@v4

- name: Log in to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push Docker image
uses: docker/build-push-action@v3
with:
context: .
file: Dockerfile
push: true
tags: ghcr.io/sebastienfi/structurizr-cli-with-bonus:latest
20 changes: 20 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Start from the structurizr/cli image
FROM structurizr/cli

# Install additional dependencies (Git, Graphviz, jq)
RUN apt-get update && \
apt-get install -y git graphviz jq && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*

# Install PlantUML
RUN wget https://downloads.sourceforge.net/project/plantuml/plantuml.jar -O /usr/local/bin/plantuml.jar && \
echo '#!/bin/bash\njava -jar /usr/local/bin/plantuml.jar "$@"' > /usr/local/bin/plantuml && \
chmod +x /usr/local/bin/plantuml

# Setup Git
RUN git config --global user.name github-actions && \
git config --global user.email github-actions@github.com

# The working directory is already set in the structurizr/cli image, but you can set it again if needed
# WORKDIR /workspace
49 changes: 47 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,47 @@
# structurizr-cli-with-bonus
A Docker image to support the Github Action "sebastienfi/structurizr-gen-images"
# Introduction

This Docker image extends the `structurizr/cli` image, including additional tools such as Git, Graphviz, jq, and PlantUML, ideal for advanced diagram generation and version control in Structurizr projects including documentation-as-code. The image is automatically built and published using a GitHub Actions workflow.

## Why do I need this?

This image is used as a container for the GitHub Action `sebastienfi/structurizr-gen-images` which allows you to generate images for your views automatically for each PR which modifies the `workspace.dsl` file. The generated images are committed into the PR. [Read more about this action](#). A second action `sebastienfi/structurizr-pr-comment` makes a comment on the pull request with the generated images.

You can also build on top of it your own action, or use it locally to generate images without having to install PlantUML or Graphviz yourself.

## Getting the Image

The image is automatically built and published to the GitHub Container Registry. You can pull the image using the following command:

```bash
docker pull ghcr.io/sebastienfi/structurizr-cli-with-bonus:latest
```

Alternatively, to build the image locally:

```bash
git clone git@github.com:sebastienfi/structurizr-cli-with-bonus.git
cd structurizr-cli-with-bonus
docker build -t my-structurizr-image .
```

## How to Use the Image

Run a container based on the image:

```bash
docker run -it --rm -v $(pwd):/workspace ghcr.io/sebastienfi/structurizr-cli-with-bonus:latest
```

This command runs the container interactively, removes it after exit, and mounts the current directory to the container's workspace.

## Included Tools

- **jq**: A lightweight and flexible command-line JSON processor.
- **Git**: For version control of your Structurizr projects.
- **Graphviz**: Enables graph-based diagram representations.
- **PlantUML**: Supports UML diagram generation within Structurizr.


## Contributing

If you have suggestions for improving this Docker image, please submit an issue or pull request to the repository.

0 comments on commit 6fcd3fa

Please sign in to comment.