Skip to content

Commit

Permalink
Improve Dockerfile and compose.yaml
Browse files Browse the repository at this point in the history
- Dockerfile:
  - Accept HOST_UID as an ARG and set a default value

- compose.yaml:
  - Persist /usr/local/bundle as a volume
  - Pass HOST_UID to avoid permission issues
  - Set a default value for HOST_UID if not provided
  - Update usage comments
  • Loading branch information
znz committed Jan 24, 2025
1 parent 4367536 commit 2a3e882
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
FROM ruby:3.4.1-bookworm
RUN useradd rurema --create-home --shell /bin/bash
ARG HOST_UID=1000
RUN useradd rurema -u ${HOST_UID} --create-home --shell /bin/bash
USER rurema:rurema
ENV BUNDLE_AUTO_INSTALL true
WORKDIR /workspaces/doctree
Expand Down
19 changes: 13 additions & 6 deletions compose.yaml
Original file line number Diff line number Diff line change
@@ -1,18 +1,25 @@
# usage:
#
# docker compose build
# docker compose build --build-arg HOST_UID=$(id -u)
# docker compose run --rm rurema rake -T
# docker compose run --rm rurema rake generate:2.7.0 statichtml:2.7.0
# open _site/2.7.0/index.html instead of /tmp/html/2.7.0/index.html
# docker compose run --rm rurema rake generate:3.4 statichtml:3.4
# open _site/3.4/index.html instead of /tmp/html/3.4/index.html
services:
rurema:
build: .
build:
context: .
args:
HOST_UID: ${HOST_UID:-1000}
volumes:
- ..:/workspaces:cached
- "./_site:/tmp/html/"
- "bundle_cache:/usr/local/bundle"
web:
image: nginx
ports:
- "8080:80"
- "8080:80"
volumes:
- "./_site:/usr/share/nginx/html:ro"
- "./_site:/usr/share/nginx/html:ro"

volumes:
bundle_cache:

0 comments on commit 2a3e882

Please sign in to comment.