aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/docker-compose.yml
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2020-05-06 15:44:59 +0300
committerEgor Tensin <Egor.Tensin@gmail.com>2020-05-06 16:21:53 +0300
commitb05b07345084c415e6da431a5e247ac9afa09065 (patch)
tree8e1b98cef39de780e07fd0108e8f3aebdfd39d04 /docker-compose.yml
parentset up GitHub Actions (diff)
downloadjekyll-docker-b05b07345084c415e6da431a5e247ac9afa09065.tar.gz
jekyll-docker-b05b07345084c415e6da431a5e247ac9afa09065.zip
fix GitHub action tests
That's a messy commit, but it required a lot of changes to get everything right. * Docker: create user jekyll with UID/GID that match the user that built the image (for seamless writes to /project). * Docker: run the container by the current user for the same purpose. * Docker: add an ENTRYPOINT to drop root privileges & check if the running user is the same as the one who built the image. * Jekyll: use --drafts. * Makefile: add docker/logs. As a side note, Docker + non-root users + bind mounts are a pain, I even wrote a blog post to make sense of it all: https://egor-tensin.github.io/blog/2020/05/06/docker-bind-mounts.html
Diffstat (limited to '')
-rw-r--r--docker-compose.yml7
1 files changed, 5 insertions, 2 deletions
diff --git a/docker-compose.yml b/docker-compose.yml
index 97aa312..5ed8a86 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -20,13 +20,15 @@ services:
context: .
dockerfile: Dockerfile.base
args:
- JEKYLL_USER: developer
+ - JEKYLL_UID
+ - JEKYLL_GID
+ user: "$JEKYLL_UID:$JEKYLL_GID"
project:
build:
context: "${PROJECT_DIR:-..}"
# Dockerfile outside of the build context.
# This is supposedly supported by Docker since 18.03, but I couldn't find
- # a less hacky way to do it.
+ # a less hacky way to do it in docker-compose.
# Source: https://github.com/docker/compose/issues/4926.
dockerfile: "$PWD/Dockerfile.project"
depends_on:
@@ -35,5 +37,6 @@ services:
- base
ports:
- 4000:4000
+ user: "$JEKYLL_UID:$JEKYLL_GID"
volumes:
- "${PROJECT_DIR:-..}:/project"