Skip to content

Commit

Permalink
Provide single Dockerfile with Mono, GrGen.NET, and BiGGer (solves #2)
Browse files Browse the repository at this point in the history
  • Loading branch information
PioBeat committed Jun 3, 2024
1 parent 0117922 commit d5adc1a
Show file tree
Hide file tree
Showing 3 changed files with 115 additions and 0 deletions.
36 changes: 36 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,7 @@ Conversion finished successfully. All model files are created in the folder /grg
### Executing the Binary

An executable tool in form of a `*.jar` is provided within the `./bin/` directory of this project after [building](#build-configuration).
Another way is to use the Docker image within the `docker/` folder (see section [Docker](#docker-container-setup)).

To start the application, issue the following command in the terminal:

Expand Down Expand Up @@ -460,6 +461,41 @@ A dedicated profile `docs` is available that can be combined with other profiles
The generated API documentation can be found at `target/apidocs/` from the root of this project.
The respective javadoc `*.jar` is located in the `target/` folder.

## Docker Container Setup

This project is shipped also with a Dockerfile.
The container comes with Mono, GrGen.NET, and BiGGer already installed.
To build the Docker image and to run the interactive shell of the Docker container, execute the following commands:

```shell
cd docker
docker build -t bigger-setup .
docker run -it bigger-setup /bin/bash
```

Building can take some time, also more than X min.

To run a demo, issue the following commands inside the running Docker container:
```shell
# Change directory if you are not in /bigraphs.grgen-bigraphs/bin/
cd /bigraphs.grgen-bigraphs/bin/

# Execute BiGGer for the example use case 'concurrent-append'
java -jar bigger.jar --verbose --basepath=../sample/concurrent-append/ --host=host.xmi --output=foo --sig=sig.xmi --sigM=signatureMetaModel.ecore --metamodel=bigraphMetaModel.ecore --rule=nextRule:nextRule-lhs.xmi,nextRule-rhs.xmi --rule=appendRule:appendRule-lhs.xmi,appendRule-rhs.xmi --rule=returnRule:returnRule-lhs.xmi,returnRule-rhs.xmi --tracking=map.json

# Observe the resulting files
cd ../sample/concurrent-append/foo
GrShell script.grs
```

Note that you will not see GrGen.NET's graph visualization window (via yComp). You will probably see an exception.
However, the transformation of BiGGer and the execution of GrGen.NET rewriting can still be tested.

To remove the Docker image:
```shell
docker rmi -f $(docker images --filter=reference="bigger-setup" -q)
```

## Troubleshooting

If you get errors while using **BiGGer**, GrGen.NET or yComp, this section provides some help.
Expand Down
79 changes: 79 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
FROM ubuntu:22.04

# Set environment variables for non-interactive installation
ENV DEBIAN_FRONTEND=noninteractive

# Update and install dependencies
RUN apt update && apt install -y \
wget \
curl \
unzip \
xauth \
xorg \
xvfb \
git \
openjdk-17-jdk \
openjdk-11-jdk \
maven \
&& rm -rf /var/lib/apt/lists/*

# Switch to the root user
USER root
# Change shell
SHELL ["/bin/bash", "-c"]


## jEnv Setup
# Install jEnv
RUN git clone https://github.com/jenv/jenv.git ~/.jenv
# Add jEnv to the shell profile
ENV PATH="~/.jenv/bin:$PATH"
# The interactive shell sources .bashrc (instead of bash_profile)
RUN echo 'export PATH="~/.jenv/bin:$PATH"' >> ~/.bashrc
RUN echo 'eval "$(jenv init -)"' >> ~/.bashrc
# Have JAVA_HOME get set by jEnv and get it loaded in the bash
RUN /bin/bash -c 'source ~/.bashrc && eval "$(jenv init -)" && jenv enable-plugin export'
RUN /bin/bash -c 'source ~/.bashrc && exec $SHELL -l'
# Set up jEnv for both Java versions; configure global one
RUN /bin/bash -c "source ~/.bashrc && jenv add /usr/lib/jvm/java-17-openjdk-amd64" \
&& /bin/bash -c "source ~/.bashrc && jenv add /usr/lib/jvm/java-11-openjdk-amd64" \
&& /bin/bash -c "source ~/.bashrc && jenv global 17"


## GrGen.NET Setup
#https://grgen.de/GrGenNET-V6.7-2023-05-18.zip
COPY GrGenNET-V6.7-2023-05-18.zip /workspace/
RUN mkdir /opt/grgen \
&& cd /workspace/ && unzip GrGenNET-V6.7-2023-05-18.zip \
&& mv GrGenNET-V6.7-2023-05-18/* /opt/grgen/ \
&& rmdir GrGenNET-V6.7-2023-05-18 \
&& rm -f GrGenNET-V6.7-2023-05-18.zip \
&& cd /opt/grgen/bin \
&& /bin/bash -c "source ~/.bashrc && jenv local 11"
ENV PATH="/opt/grgen/bin:$PATH"


## Mono Setup
RUN apt update && apt install -y ca-certificates gnupg \
&& gpg --homedir /tmp --no-default-keyring --keyring /usr/share/keyrings/mono-official-archive-keyring.gpg --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF \
&& echo "deb [signed-by=/usr/share/keyrings/mono-official-archive-keyring.gpg] https://download.mono-project.com/repo/ubuntu stable-focal main" | tee /etc/apt/sources.list.d/mono-official-stable.list \
&& apt update \
&& apt install -y mono-devel


## BiGGer Setup
# Clone repository, check out latest version tag, and build the tool
RUN git clone https://github.com/bigraph-toolkit-suite/bigraphs.grgen-bigraphs.git \
&& cd bigraphs.grgen-bigraphs \
&& git checkout tags/v1.1.0 \
&& /bin/bash -c "source ~/.bashrc && jenv local 17" \
&& /bin/bash -c "source ~/.bashrc && mvn clean package -PfatJar -DskipTests" \
RUN /bin/bash -c "source ~/.bashrc && echo 'chmod +x /bigraphs.grgen-bigraphs/bin/bigger.jar' >> ~/.bashrc"
# Add generated bigger.jar to the ENV path
ENV PATH="/bigraphs.grgen-bigraphs/bin:$PATH"


# Set up the working directory
WORKDIR /bigraphs.grgen-bigraphs/bin
# Set the default command to run bash
CMD [ "/bin/bash", "-c" ]
Binary file added docker/GrGenNET-V6.7-2023-05-18.zip
Binary file not shown.

0 comments on commit d5adc1a

Please sign in to comment.