|
1 | 1 | FROM ruby:latest
|
2 | 2 |
|
| 3 | +# uncomment these if you are having this issue with the build: |
| 4 | +# /usr/local/bundle/gems/jekyll-4.3.4/lib/jekyll/site.rb:509:in `initialize': Permission denied @ rb_sysopen - /srv/jekyll/.jekyll-cache/.gitignore (Errno::EACCES) |
| 5 | +# ARG GROUPID=901 |
| 6 | +# ARG GROUPNAME=ruby |
| 7 | +# ARG USERID=901 |
| 8 | +# ARG USERNAME=jekyll |
| 9 | + |
3 | 10 | ENV DEBIAN_FRONTEND noninteractive
|
4 | 11 |
|
5 |
| -Label MAINTAINER Amir Pourmand |
| 12 | +LABEL authors="Amir Pourmand,George Araújo" \ |
| 13 | + description="Docker image for al-folio academic template" \ |
| 14 | + maintainer="Amir Pourmand" |
| 15 | + |
| 16 | +# uncomment these if you are having this issue with the build: |
| 17 | +# /usr/local/bundle/gems/jekyll-4.3.4/lib/jekyll/site.rb:509:in `initialize': Permission denied @ rb_sysopen - /srv/jekyll/.jekyll-cache/.gitignore (Errno::EACCES) |
| 18 | +# add a non-root user to the image with a specific group and user id to avoid permission issues |
| 19 | +# RUN groupadd -r $GROUPNAME -g $GROUPID && \ |
| 20 | +# useradd -u $USERID -m -g $GROUPNAME $USERNAME |
6 | 21 |
|
7 |
| -RUN apt-get update -y && apt-get install -y --no-install-recommends \ |
8 |
| - locales \ |
9 |
| - nodejs npm \ |
10 |
| - imagemagick \ |
11 |
| - build-essential \ |
12 |
| - zlib1g-dev \ |
13 |
| - python3-pip \ |
14 |
| - inotify-tools procps && \ |
15 |
| - apt-get clean && rm -rf /var/lib/apt/lists/* /var/cache/apt/archives/* && \ |
16 |
| - pip install nbconvert --break-system-packages |
| 22 | +# install system dependencies |
| 23 | +RUN apt-get update -y && \ |
| 24 | + apt-get install -y --no-install-recommends \ |
| 25 | + build-essential \ |
| 26 | + curl \ |
| 27 | + imagemagick \ |
| 28 | + inotify-tools \ |
| 29 | + locales \ |
| 30 | + nodejs \ |
| 31 | + procps \ |
| 32 | + python3-pip \ |
| 33 | + zlib1g-dev && \ |
| 34 | + pip --no-cache-dir install --upgrade --break-system-packages nbconvert |
17 | 35 |
|
| 36 | +# clean up |
| 37 | +RUN apt-get clean && \ |
| 38 | + apt-get autoremove && \ |
| 39 | + rm -rf /var/lib/apt/lists/* /var/cache/apt/archives/* /tmp/* |
18 | 40 |
|
| 41 | +# set the locale |
19 | 42 | RUN sed -i '/en_US.UTF-8/s/^# //g' /etc/locale.gen && \
|
20 | 43 | locale-gen
|
21 | 44 |
|
22 |
| - |
23 |
| -ENV LANG=en_US.UTF-8 \ |
| 45 | +# set environment variables |
| 46 | +ENV EXECJS_RUNTIME=Node \ |
| 47 | + JEKYLL_ENV=production \ |
| 48 | + LANG=en_US.UTF-8 \ |
24 | 49 | LANGUAGE=en_US:en \
|
25 |
| - LC_ALL=en_US.UTF-8 \ |
26 |
| - JEKYLL_ENV=production |
| 50 | + LC_ALL=en_US.UTF-8 |
27 | 51 |
|
| 52 | +# create a directory for the jekyll site |
28 | 53 | RUN mkdir /srv/jekyll
|
29 | 54 |
|
| 55 | +# copy the Gemfile and Gemfile.lock to the image |
30 | 56 | ADD Gemfile.lock /srv/jekyll
|
31 | 57 | ADD Gemfile /srv/jekyll
|
32 | 58 |
|
| 59 | +# set the working directory |
33 | 60 | WORKDIR /srv/jekyll
|
34 | 61 |
|
35 | 62 | # install jekyll and dependencies
|
36 |
| -RUN gem install jekyll bundler |
37 |
| - |
| 63 | +RUN gem install --no-document jekyll bundler |
38 | 64 | RUN bundle install --no-cache
|
39 |
| -# && rm -rf /var/lib/gems/3.1.0/cache |
| 65 | + |
40 | 66 | EXPOSE 8080
|
41 | 67 |
|
42 | 68 | COPY bin/entry_point.sh /tmp/entry_point.sh
|
43 | 69 |
|
| 70 | +# uncomment this if you are having this issue with the build: |
| 71 | +# /usr/local/bundle/gems/jekyll-4.3.4/lib/jekyll/site.rb:509:in `initialize': Permission denied @ rb_sysopen - /srv/jekyll/.jekyll-cache/.gitignore (Errno::EACCES) |
| 72 | +# set the ownership of the jekyll site directory to the non-root user |
| 73 | +# USER $USERNAME |
| 74 | + |
44 | 75 | CMD ["/tmp/entry_point.sh"]
|
0 commit comments