From e2a4f6ce73b317583ec8abc5b44ffcfb600ecfc1 Mon Sep 17 00:00:00 2001 From: khalidbelk Date: Sun, 16 Feb 2025 22:59:02 +0100 Subject: [PATCH 1/7] feat: add Dockerfile --- Dockerfile | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..7fa4f5e --- /dev/null +++ b/Dockerfile @@ -0,0 +1,17 @@ +FROM ocaml/opam:ubuntu-20.04-ocaml-4.14 + +WORKDIR /data + +COPY . . + +RUN sudo apt-get update && sudo apt-get install -y make + +RUN opam init -y + +RUN opam install -y dune + +USER root + +RUN eval $(opam env) && make + +CMD ["./puml2xml"] From caf2d3ab3016a664382ae4980dc61605e9608ad4 Mon Sep 17 00:00:00 2001 From: khalidbelk Date: Sun, 16 Feb 2025 23:23:43 +0100 Subject: [PATCH 2/7] docs: add Docker usage instructions to README --- README.md | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 686c955..bc32db8 100644 --- a/README.md +++ b/README.md @@ -15,25 +15,46 @@ A **PlantUML** (.puml) to **XML** (.xmi) converter. ### Prerequisites -Before starting, ensure you have the following dependencies installed locally: +Before starting, If you want to run it locally, ensure you have the following dependencies installed, otherwise **you'll just need Docker**, and can ignore this : - **dune** (v**3.16** or higher) - **OCaml** (v**4.08.0** or higher) - **make** -### Usage +## Installation **Steps** 1. Clone this repository and open it +### Local install + 2. Compile the program with the command ``` make ``` -3. Then you can use it as specified here : +### Docker 🐳 + +2. Build the image with the command + +``` +docker build -t puml2xml . +``` + +3. Run the container + +``` +docker run --rm -v $(pwd):/data/input puml2xml ./puml2xml /data/input/ +``` + +> Note: for this last command, you'll just have to replace by the .puml file you want to convert (located in your current directory). + + +## Usage + +You can use it as specified here : ``` USAGE: ./puml2xml [OPTIONS] From 6433dd64cc9862b1d99ac342dffad5acaa4c2494 Mon Sep 17 00:00:00 2001 From: khalidbelk Date: Sun, 16 Feb 2025 23:28:47 +0100 Subject: [PATCH 3/7] feat: add docker workflow --- .github/workflows/docker-build.yml | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 .github/workflows/docker-build.yml diff --git a/.github/workflows/docker-build.yml b/.github/workflows/docker-build.yml new file mode 100644 index 0000000..a011b82 --- /dev/null +++ b/.github/workflows/docker-build.yml @@ -0,0 +1,26 @@ +name: 🐳 Docker Build + +on: + push: + branches: [main, dev, testCI] + +jobs: + + docker-build: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Build Docker image + run: docker build -t puml2xml . + + - name: Run Docker container - Smoke Test + run: | + docker run --rm -d --name test-container puml2xml + sleep 5 + if ! docker ps | grep test-container; then + echo "Container did not start correctly" + exit 1 + fi + docker stop test-container \ No newline at end of file From 5ae127603c9d578d0d5bccb7e555811dd7959266 Mon Sep 17 00:00:00 2001 From: khalidbelk Date: Sun, 16 Feb 2025 23:36:14 +0100 Subject: [PATCH 4/7] fix: remove useless cmd from dockerfile --- Dockerfile | 2 -- 1 file changed, 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 7fa4f5e..f3e3108 100644 --- a/Dockerfile +++ b/Dockerfile @@ -13,5 +13,3 @@ RUN opam install -y dune USER root RUN eval $(opam env) && make - -CMD ["./puml2xml"] From 5eb018c7ae19a6f5b160e07c0052d6aed9de10ae Mon Sep 17 00:00:00 2001 From: khalidbelk Date: Sun, 16 Feb 2025 23:37:41 +0100 Subject: [PATCH 5/7] fix: change the way we test the dockerfile in the workflow --- .github/workflows/docker-build.yml | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/.github/workflows/docker-build.yml b/.github/workflows/docker-build.yml index a011b82..d391819 100644 --- a/.github/workflows/docker-build.yml +++ b/.github/workflows/docker-build.yml @@ -18,9 +18,5 @@ jobs: - name: Run Docker container - Smoke Test run: | docker run --rm -d --name test-container puml2xml - sleep 5 - if ! docker ps | grep test-container; then - echo "Container did not start correctly" - exit 1 - fi - docker stop test-container \ No newline at end of file + docker run --rm puml2xml ls -l /data/puml2xml + docker run --rm puml2xml /data/puml2xml -h \ No newline at end of file From 5e80788e7fa88aaea691b777fe2796aa2c8442c3 Mon Sep 17 00:00:00 2001 From: khalidbelk Date: Sun, 16 Feb 2025 23:48:50 +0100 Subject: [PATCH 6/7] docs: add Docker build status badge to README --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index bc32db8..abdc626 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,10 @@      macOS-latest +      + + Docker Build + From bef2389e43938367cac4b6afc0086fdd8c4fd802 Mon Sep 17 00:00:00 2001 From: khalidbelk Date: Sun, 16 Feb 2025 23:51:30 +0100 Subject: [PATCH 7/7] docs: fix hyperlink tags in README's badge container --- README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/README.md b/README.md index abdc626..c02e405 100644 --- a/README.md +++ b/README.md @@ -5,12 +5,11 @@ ubuntu-latest      - macOS-latest + macOS-latest      Docker Build -