Commit c19d780f authored by Andreas Knote's avatar Andreas Knote

migrate to faster image resizing

parent 915b3144
Pipeline #22675 passed with stage
in 12 minutes and 25 seconds
FROM ubuntu:focal AS nodejs_base
FROM ubuntu:focal AS essential_base
LABEL maintainer="andreas.knote@uni-wuerzburg.de"
......@@ -9,15 +9,9 @@ RUN apt-get update && apt-get upgrade && \
apt-get install -y \
curl ssh git-lfs build-essential locales
RUN apt-get update && \
curl -sL https://deb.nodesource.com/setup_13.x | bash - && \
apt-get install -y nodejs && \
echo 'Node: ' && \
node -v && \
echo 'NPM: ' && \
npm -v
FROM nodejs_base AS ruby_jekyll
# Install Ruby and Jekyll
FROM essential_base AS ruby_jekyll
RUN apt-get update && \
apt-get install -y \
......@@ -39,18 +33,37 @@ RUN locale-gen en_US.UTF-8 && \
ENV LANG en_US.UTF-8
ENV LC_ALL en_US.UTF-8
FROM ruby_jekyll AS image_resize
RUN apt-get update && apt-get install -y \
imagemagick
## Install NodeJS
FROM ruby_jekyll AS nodejs
RUN apt-get update && \
curl -sL https://deb.nodesource.com/setup_13.x | bash - && \
apt-get install -y nodejs && \
echo 'Node: ' && \
node -v && \
echo 'NPM: ' && \
npm -v
FROM image_resize AS hci_theme
## Install the batch-resize script
FROM nodejs AS image_resize
## Build Theme from source
RUN apt-get update && apt-get install -y \
python3-pil imgp rsync inotify-tools && \
git clone https://gitlab2.informatik.uni-wuerzburg.de/hci-development/batch-resize.git /batch-resize && \
ln -s /batch-resize/batch-resize /usr/bin/batch-resize
## Build HCI-Theme from source
## Installs the built gem system-wide
COPY . /
RUN bundle install && \
bundle exec rake gem && \
gem install hci-theme.gem && \
rm -rf node_modules && \
rm package-lock.json
# Make development scripts available
RUN ln -s /scripts/* /usr/bin/ && hash
#!/usr/bin/env bash
# Build
# Resize Images
watch-and-resize ./assets/images/ ./public/assets/images/ &
# Serve HCI Site
bundle
bundle update
bundle exec war&
jekyll serve --host=0.0.0.0 --port=4200 --trace --incremental&
jekyll serve --host=0.0.0.0 --port=4200 --trace --incremental &
PIDS[0]=$!
trap "kill ${PIDS[*]}" SIGINT
wait
\ No newline at end of file
wait
#!/usr/bin/env bash
source_dir=${1}
target_dir=${2}
batch-resize ${source_dir} ${target_dir}
echo "[watch-and-resize] $source_dir -> $target_dir"
while inotifywait -q -e modify -r ${source_dir}; do
batch-resize ${source_dir} ${target_dir}
done
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment