Skip to content

Commit 6dad817

Browse files
author
Chad Dougherty
authored
Merge pull request #1559 from crd477/fix/docker
Fix Dockerfile for working with local previews
2 parents fd9a09c + 10779c4 commit 6dad817

File tree

3 files changed

+22
-23
lines changed

3 files changed

+22
-23
lines changed

Dockerfile

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,14 @@
1-
FROM jekyll/jekyll:3.8
2-
## Currently jekyll/jekyll:4 fails with the error below so tag 3.8 is used instead.
3-
# Dockerfile:10
4-
# --------------------
5-
# 8 | ## Install required gems
6-
# 9 | COPY ./Gemfile ./Gemfile
7-
# 10 | >>> RUN bundle install
8-
# 11 |
9-
# 12 | ## Copy source files
10-
# --------------------
11-
# ERROR: failed to solve: process "/bin/sh -c bundle install"
12-
# did not complete successfully: exit code: 5
1+
FROM jekyll/jekyll:stable
132

143
ENV JEKYLL_UID=1000
154
ENV JEKYLL_GID=1000
165

17-
USER ${JEKYLL_UID}
18-
196
## Install required gems
207
COPY ./Gemfile ./Gemfile
218
RUN bundle install
229

10+
USER ${JEKYLL_UID}
11+
2312
## Copy source files
2413
COPY --chown=${JEKYLL_UID}:${JEKYLL_GID} ./ ./
2514

docs/local_previews.md

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
# Working with the repo locally
22

3-
Content-only changes can often be done directly on the GitHub website. Changes affecting the function or structure of the site should be previewed fully locally before being submitted via PR.
3+
Content-only changes can often be done directly on the GitHub website. Changes affecting the function or structure of the site should be previewed fully locally before being submitted via PR.
44

55
## Jekyll
66

7-
To preview the site locally, clone it.
7+
To preview the site locally, clone it.
88

99
Then you'll need to [install jekyll](https://jekyllrb.com/docs/installation/).
1010

@@ -14,9 +14,9 @@ Then go to the root of the site and issue (just once):
1414
$ bundle install
1515
```
1616

17-
which will install the necessary Ruby gems (the info for this is included in the repo files).
17+
which will install the necessary Ruby gems (the info for this is included in the repo files).
1818

19-
And then (also in the top level directory of your forked repository) to be able to see the rendered website, run
19+
And then (also in the top level directory of your forked repository) to be able to see the rendered website, run
2020

2121
```bash
2222
$ jekyll serve
@@ -32,6 +32,8 @@ If you are having trouble try `rm -rf _site`, followed by `bundle update`, then
3232

3333
You can build and run a Docker container to preview the site locally and support a local development workflow. If you do not already have Docker installed, please visit https://docs.docker.com/get-docker/ and follow the links to get started with Docker on your operating system.
3434

35+
These instructions also work with the [Podman](https://podman.io/) container management tool simply by substituting `podman` for `docker` in the commands below. This can either be done manually, by creating a shell alias (e.g., `alias podman=docker`), or by installing a package such as `podman-docker` to automatically handle this translation.
36+
3537
Build the container image:
3638

3739
```bash
@@ -59,9 +61,21 @@ To develop the website, launch the container using the following command, where
5961

6062
```bash
6163
docker run --rm -it -p 4000:4000 \
62-
-v $(pwd):/srv/jekyll \
64+
-u $(id -u):$(id -g) \
65+
-v $(pwd):/srv/jekyll:Z \
6366
us-rse-website:latest
6467
```
6568

69+
or, if using Podman in a rootless environment:
70+
71+
```bash
72+
podman run --rm -it -p 4000:4000 \
73+
--userns=keep-id \
74+
-v $(pwd):/srv/jekyll:Z \
75+
us-rse-website:latest
76+
```
77+
78+
If these commands fail, you may need to address any discrepancies between the user/group mapping in your container runtime and the permissions on the directory where the volume mount resides.
79+
6680
Edit a source file and save the changes. You will see Jekyll automatically regenerate the site, after which you can reload the page in your browser to see the rendered changes.
6781

docs/tests_ci.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -185,10 +185,6 @@ Importantly, once you create the bot you'll need to add the following secrets to
185185

186186
Yes, this means that the tokens are specific to this account.
187187

188-
#### Post New Jobs to Mastadon
189-
190-
TBD: we welcome contributions to make this happen
191-
192188
#### Greetings
193189

194190
This simple greetings action greets first-time users (for issues).

0 commit comments

Comments
 (0)