diff --git a/.github/workflows/docker-build.yml b/.github/workflows/docker-build.yml new file mode 100644 index 0000000..d391819 --- /dev/null +++ b/.github/workflows/docker-build.yml @@ -0,0 +1,22 @@ +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 + docker run --rm puml2xml ls -l /data/puml2xml + docker run --rm puml2xml /data/puml2xml -h \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..f3e3108 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,15 @@ +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 diff --git a/README.md b/README.md index 686c955..c02e405 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,10 @@ ubuntu-latest      - macOS-latest + macOS-latest +      + + Docker Build @@ -15,25 +18,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]