From d06eaf65b8e78463e4aef258dc4fa718416b90d4 Mon Sep 17 00:00:00 2001
From: Marco Aceti <marco.aceti@studenti.unimi.it>
Date: Thu, 8 Jun 2023 12:15:41 +0200
Subject: [PATCH] Update Docker image and stuff

---
 .dockerignore  | 11 ++++-------
 .gitlab-ci.yml | 25 -------------------------
 Dockerfile     | 27 ++++++++++++++++-----------
 docker-run.sh  |  5 ++---
 4 files changed, 22 insertions(+), 46 deletions(-)
 delete mode 100644 .gitlab-ci.yml

diff --git a/.dockerignore b/.dockerignore
index c0f6f7f..1df9886 100644
--- a/.dockerignore
+++ b/.dockerignore
@@ -1,12 +1,9 @@
 .git/*
 .git*
-Dockerfile
-docker-run.sh
+.mdbook-plantuml-cache
 .dockerignore
 .idea/*
-.jekyll-cache/*
-**/.jekyll-cache/*
-_site/*
-assets/resized/*
-uml/*
+book/
+Dockerfile
+docker-run.sh
 README.md
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
deleted file mode 100644
index 79a1961..0000000
--- a/.gitlab-ci.yml
+++ /dev/null
@@ -1,25 +0,0 @@
-image: ruby:3.1
-
-variables:
-  JEKYLL_ENV: production
-  LC_ALL: C.UTF-8
-
-before_script:
-  - bundle install
-
-build:
-  stage: build
-  script:
-    - apt-get update -y
-    - apt-get install -y wget default-jre default-jdk graphviz
-    - wget https://github.com/plantuml/plantuml/releases/download/v1.2022.13/plantuml-1.2022.13.jar -O plantuml.jar
-    - echo "#!/bin/bash" > plantuml
-    - echo "java -jar $PWD/plantuml.jar \"\$1\" \"\$2\"" >> plantuml
-    - mv plantuml /usr/bin/plantuml
-    - chmod +x /usr/bin/plantuml
-    - sed -i "s/\/sweng/\/sweng\/$CI_COMMIT_REF_SLUG/g" _config.yml
-    - bundle exec jekyll build -d build
-  artifacts:
-    name: jekyll-build.zip
-    paths:
-      - build
diff --git a/Dockerfile b/Dockerfile
index 4dffa4b..423ca3e 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,23 +1,28 @@
-FROM ruby:3.1
+# plantuml image
+FROM ubuntu AS plantuml
 
-# Install graphviz and PlantUML
 RUN apt-get update -y 
 RUN apt-get install -y wget default-jre default-jdk graphviz
 RUN wget https://github.com/plantuml/plantuml/releases/download/v1.2022.13/plantuml-1.2022.13.jar -O plantuml.jar
 RUN echo "#!/bin/bash" > plantuml ; echo "java -jar $PWD/plantuml.jar \"\$1\" \"\$2\"" >> plantuml
 RUN mv plantuml /usr/bin/plantuml
-RUN chmod +x /usr/bin/plantuml 
+RUN chmod +x /usr/bin/plantuml
 
-# Install Ruby project dependencies (Jekyll and plugins)
-WORKDIR /usr/src/app
+# main image
+FROM rust:slim-buster
+
+RUN apt-get update && \
+    apt-get install --no-install-recommends -y \
+    libssl-dev pkg-config
+RUN cargo install mdbook
+RUN cargo install mdbook-plantuml
 
-COPY Gemfile .
-COPY Gemfile.lock .
-RUN bundle install
+COPY --from=plantuml /usr/bin/plantuml /usr/bin/plantuml
+
+EXPOSE 3000
+WORKDIR /usr/src/app
 
 # Copy project files
 COPY . .
 
-EXPOSE 4000
-EXPOSE 35729
-ENTRYPOINT ["bundle", "exec", "jekyll", "serve", "--host", "0.0.0.0"]
+ENTRYPOINT ["mdbook"]
diff --git a/docker-run.sh b/docker-run.sh
index de19ef9..a4956be 100755
--- a/docker-run.sh
+++ b/docker-run.sh
@@ -5,8 +5,7 @@ docker run \
     --interactive \
     --tty \
     --mount type=bind,source="$(pwd)",target=/usr/src/app \
-    --publish 4000:4000 \
-    --publish 35729:35729 \
+    --publish 3000:3000 \
     --user $(id -u):$(id -g) \
     appunti_sweng \
-    --livereload 
+    serve --hostname 0.0.0.0 --port 3000
-- 
GitLab