From 93dfab27408fbbbbccd9e2bc89925deef71ee92f Mon Sep 17 00:00:00 2001 From: Adrian Kosmaczewski Date: Mon, 4 Sep 2023 14:59:13 +0200 Subject: [PATCH] Fixed excessive CPU usage --- Dockerfile | 20 ++++++++++---------- Guardfile | 8 +++++++- 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/Dockerfile b/Dockerfile index 58f6f39..4a250f7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,8 +1,8 @@ FROM ghcr.io/vshn/asciidoctor-slides:1.17.0 -RUN addgroup -S preview && adduser -S preview -G preview -RUN mkdir -p /presentation && chown -R preview:preview /presentation -RUN mkdir -p /build && chown -R preview:preview /build +RUN addgroup -S preview && adduser -S preview -G preview && \ + mkdir -p /presentation && chown -R preview:preview /presentation && \ + mkdir -p /build && chown -R preview:preview /build WORKDIR /build @@ -10,13 +10,13 @@ WORKDIR /build # https://github.com/bebraven/platform/pull/82/files # to fix file system notification issues when running this image in a Mac -RUN apk update && apk add curl unzip build-base ruby-dev ruby-rdoc libnotify -RUN gem install guard guard-livereload guard-shell libnotify - -RUN curl --silent --location https://github.com/caddyserver/caddy/releases/download/v2.4.6/caddy_2.4.6_linux_amd64.tar.gz -o /build/caddy.tar.gz -RUN tar -zxvf /build/caddy.tar.gz -RUN mv /build/caddy /usr/local/bin/caddy -RUN rm /build/caddy.tar.gz +RUN apk update && apk add curl unzip build-base ruby-dev ruby-rdoc libnotify && \ + gem install --no-document guard guard-livereload guard-shell libnotify && \ + apk del build-base ruby-dev && \ + curl --silent --location https://github.com/caddyserver/caddy/releases/download/v2.4.6/caddy_2.4.6_linux_amd64.tar.gz -o /build/caddy.tar.gz && \ + tar -zxvf /build/caddy.tar.gz && \ + mv /build/caddy /usr/local/bin/caddy && \ + rm /build/caddy.tar.gz COPY slides-preview.sh /usr/local/bin/ COPY signal-listener.sh /usr/local/bin/ diff --git a/Guardfile b/Guardfile index b23f09b..2fe38d4 100644 --- a/Guardfile +++ b/Guardfile @@ -1,7 +1,13 @@ +# Very important! +ignore %r{^node_modules/} + group :presentation do # Rebuild documentation when modifying files guard :shell do - watch(/slides.adoc/) do + watch(/(.*).adoc/) do |a| + time = Time.new + timestring = time.strftime("%H:%M:%S") + puts "#{timestring} - INFO - Got change for: #{a[0]}" `generate-vshn-slides --filename=slides.adoc` end end