aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin H. Johnson <robbat2@gentoo.org>2020-06-21 12:20:42 -0700
committerRobin H. Johnson <robbat2@gentoo.org>2020-06-21 12:20:42 -0700
commit1909e316dcf89c0a36434091e241eaa5d17bdb83 (patch)
treef790e056b394292e08017be5ca21be1f1199e288
parentbin: bundle install needs network (diff)
downloadwww-1909e316dcf89c0a36434091e241eaa5d17bdb83.tar.gz
www-1909e316dcf89c0a36434091e241eaa5d17bdb83.tar.bz2
www-1909e316dcf89c0a36434091e241eaa5d17bdb83.zip
Docker: large refactor & improvements
Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
-rw-r--r--.dockerignore4
-rw-r--r--Dockerfile20
-rw-r--r--_config.yml9
-rw-r--r--bin/docker-helper.inc11
-rwxr-xr-xbin/docker-setup.sh2
-rw-r--r--docker/Dockerfile8
6 files changed, 38 insertions, 16 deletions
diff --git a/.dockerignore b/.dockerignore
new file mode 100644
index 0000000..15d0ebf
--- /dev/null
+++ b/.dockerignore
@@ -0,0 +1,4 @@
+# Exclude everything except specified files.
+*
+!Gemfile
+!Gemfile.lock
diff --git a/Dockerfile b/Dockerfile
new file mode 100644
index 0000000..a9a89f8
--- /dev/null
+++ b/Dockerfile
@@ -0,0 +1,20 @@
+ARG JEKYLL_VERSION=4.1.0
+FROM jekyll/jekyll:${JEKYLL_VERSION}
+# py3-pygments: Needed for rbst Gem, because it calls Python directly
+# py3-docutils: Needed for GLEPs
+# GnuPG: Needed for WKD
+RUN apk add --no-cache \
+ gnupg \
+ python3 \
+ py3-docutils \
+ py3-pygments \
+ && ln -sf python3 /usr/bin/python
+
+# Ruby stuff
+COPY Gemfile /srv/jekyll/
+COPY Gemfile.lock /srv/jekyll/
+ARG BUNDLE_JOBS=2
+RUN cd /srv/jekyll/ \
+ && bundle install \
+ && rm -vrf \
+ /home/jekyll/.bundle/cache
diff --git a/_config.yml b/_config.yml
index 695e580..fd760db 100644
--- a/_config.yml
+++ b/_config.yml
@@ -41,11 +41,14 @@ defaults:
values:
layout: passthrough
+plugins: ['nokogiri']
+# Exclude everything and only include specific items
exclude:
- bin
+- Dockerfile*
+- .dockerignore
+- Gemfile*
+- Makefile
- README.md
- TODO
- wget-log*
-- docker/
-- Gemfile*
-plugins: ['nokogiri']
diff --git a/bin/docker-helper.inc b/bin/docker-helper.inc
index d084d2e..a1bc41f 100644
--- a/bin/docker-helper.inc
+++ b/bin/docker-helper.inc
@@ -5,7 +5,7 @@ TRACE=${TRACE:=0}
IMAGE_NAME=docker.gentoo.org/sites/www
IMAGE_TAG=latest
IMAGE=${IMAGE_NAME}:${IMAGE_TAG}
-IMAGE_SRC=docker/
+IMAGE_SRC=./
docker_build() {
# Always refresh the image
@@ -17,10 +17,15 @@ docker_build() {
}
_docker_run_common() {
+ _UID=$(id -u)
+ _GID=$(id -g)
docker run \
--rm \
- -e JEKYLL_UID="$(id -u)" \
- -e JEKYLL_GID="$(id -g)" \
+ -e JEKYLL_UID="${_UID}" \
+ -e JEKYLL_GID="${_GID}" \
+ -e JEKYLL_ROOTLESS= \
+ -e CONNECTED=false \
+ -e DEBUG=false \
--volume="${PWD}:/srv/jekyll" \
"$@"
}
diff --git a/bin/docker-setup.sh b/bin/docker-setup.sh
index 217425d..7722a53 100755
--- a/bin/docker-setup.sh
+++ b/bin/docker-setup.sh
@@ -2,5 +2,3 @@
set -e
source "$(dirname "$0")"/docker-helper.inc
docker_build
-docker_run_net_host bundle install
-
diff --git a/docker/Dockerfile b/docker/Dockerfile
deleted file mode 100644
index e40b239..0000000
--- a/docker/Dockerfile
+++ /dev/null
@@ -1,8 +0,0 @@
-ARG JEKYLL_VERSION=4.1.0
-FROM jekyll/jekyll:${JEKYLL_VERSION}
-VOLUME /srv/jekyll
-# Needed for rbst Gem, because it calls Python directly
-RUN apk add python3 py3-docutils py3-pygments \
- && ln -sf python3 /usr/bin/python
-# Needed for WKD
-RUN apk add gnupg