FAQ | This is a LIVE service | Changelog

Skip to content
Snippets Groups Projects
Verified Commit 1b925f33 authored by Hal Blackburn's avatar Hal Blackburn
Browse files

refactor: make the guidebook working_dir configurable

When the workspace/git checkout is a container volume, it can't be
mounted with a regular bind mount, as the compose config needs to know
the volume name, mount point, and subdirectory within the mount point to
use as the working directory.

This commit allows these 3 options to be configured using environment
variables, so that a devcontainer config can override the guidebook
service mounts to reference the devcontainer's volume. The defaults
continue to use the local bind mount, so using the compose config without
additional configuration will work as before.
parent 86e3f8a2
No related branches found
No related tags found
2 merge requests!443Add devcontainer config and adjust docker compose to work with docker volumes,!441Add devcontainer config and adjust docker compose to work with docker volumes
# syntax=docker/dockerfile:1.4
FROM plantuml/plantuml-server:jetty AS plantuml
COPY compose/jetty-logging.properties /var/lib/jetty/resources/jetty-logging.properties
ENV JAVA_OPTIONS=-Djava.util.logging.config.file=/var/lib/jetty/resources/jetty-logging.properties
......@@ -11,10 +13,16 @@ WORKDIR /workspace/
COPY requirements.txt .
RUN pip install -r requirements.txt
COPY --chmod=755 <<EOF /docker-entrypoint.sh
#!/usr/bin/env sh
# We use git to determine the edit history fo pages to provide a "last updated" timestamp. Work
# around a git feature which guards against certain types of attacks from untrusted users.
#
# More information: https://www.kenmuse.com/blog/avoiding-dubious-ownership-in-dev-containers/
RUN git config --global --add safe.directory /workspace
git config --global --add safe.directory .
exec "\$@"
EOF
ENTRYPOINT ["/docker-entrypoint.sh"]
CMD ["mkdocs", "serve", "-a", "0.0.0.0:8000"]
......@@ -2,9 +2,8 @@ services:
guidebook:
build: .
volumes:
- type: bind
source: .
target: /workspace
- ${WORKSPACE_SOURCE:-.}:${WORKSPACE_TARGET:-/workspace}
working_dir: ${WORKSPACE_ROOT:-/workspace}
ports:
- "8000:8000"
depends_on:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment