diff options
author | Egor Tensin <Egor.Tensin@gmail.com> | 2020-05-06 15:44:59 +0300 |
---|---|---|
committer | Egor Tensin <Egor.Tensin@gmail.com> | 2020-05-06 16:21:53 +0300 |
commit | b05b07345084c415e6da431a5e247ac9afa09065 (patch) | |
tree | 8e1b98cef39de780e07fd0108e8f3aebdfd39d04 /Dockerfile.project | |
parent | set up GitHub Actions (diff) | |
download | jekyll-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-- | Dockerfile.project | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/Dockerfile.project b/Dockerfile.project index bae05e6..c9e0b50 100644 --- a/Dockerfile.project +++ b/Dockerfile.project @@ -1,10 +1,11 @@ FROM jekyll_base -ENV PROJECT_DIR="/project" -RUN sudo mkdir -p -- "$PROJECT_DIR" && \ - sudo chown -- "$JEKYLL_USER:$JEKYLL_USER" "$PROJECT_DIR" +ENV PROJECT_DIR=/project +RUN mkdir /project && chown jekyll /project +VOLUME /project + +COPY --chown=jekyll:jekyll ["Gemfile", "Gemfile.lock", "/project/"] +RUN gosu jekyll make dependencies +COPY --chown=jekyll:jekyll [".", "/project/"] -COPY --chown="$JEKYLL_USER:$JEKYLL_USER" ["Gemfile", "Gemfile.lock", "$PROJECT_DIR/"] -RUN make dependencies -COPY --chown="$JEKYLL_USER:$JEKYLL_USER" [".", "$PROJECT_DIR/"] CMD make jekyll/serve |