diff options
author | Benjamin Bach <benjamin@overtag.dk> | 2022-08-20 01:20:45 +0300 |
---|---|---|
committer | Benjamin Bach <benjamin@overtag.dk> | 2022-08-20 01:20:45 +0300 |
commit | ba65499354ab73a8223c89e1f3ec77b9bf278a63 (patch) | |
tree | bfc14c352b48516371395f43ce0c69ba84ec1e4f | |
parent | b50a451097c6f8d65b282cb9509acddc7c328ddd (diff) |
First updates migrating to docker-compose
-rw-r--r-- | Makefile | 11 | ||||
-rw-r--r-- | docker-compose.yaml | 12 | ||||
-rw-r--r-- | docker-entrypoint.sh | 5 | ||||
-rw-r--r-- | docs/contributing.rst | 5 |
4 files changed, 17 insertions, 16 deletions
@@ -2,17 +2,10 @@ SHELL := /bin/bash CWD := $(shell cd -P -- '$(shell dirname -- "$0")' && pwd -P) docker-images: - docker build -t sphinx_rtd_theme:latest . + docker-compose build docker-run: - rm -f .container_id - docker run --cidfile=.container_id -t -i -p 1919:1919 \ - --network host \ - --mount type=bind,source="$(CWD)",target=/project-readonly,readonly \ - --mount type=volume,dst=/project-readonly/sphinx_rtd_theme.egg-info,volume-driver=local \ - --mount type=bind,source="$(CWD)/src",target=/project/src,readonly \ - --mount type=bind,source="$(CWD)/docs",target=/project/docs \ - sphinx_rtd_theme:latest $(command) + docker-compose run sphinx_rtd_theme $(command) docker-copy-assets: docker cp "$(shell cat .container_id):/project/sphinx_rtd_theme" . diff --git a/docker-compose.yaml b/docker-compose.yaml new file mode 100644 index 0000000..24f4ab3 --- /dev/null +++ b/docker-compose.yaml @@ -0,0 +1,12 @@ +version: "3.2" +services: + + sphinx_rtd_theme: + build: . + volumes: + - type: "bind" + source: "./" + target: "/project-working-copy" + network_mode: host + ports: + - "1919:1919" diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index 24312c3..2a97f76 100644 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -3,9 +3,8 @@ # Install the readonly project in editable mode and make sure # all dependencies are upgrade. This is mounted in from the # outside, but it is on purpose that it is readonly! -cd /project-readonly +cp -r /project/node_modules /project-working-copy/ +cd /project-working-copy pip install --upgrade -e ".[dev]" -cd /project - npm run $@ diff --git a/docs/contributing.rst b/docs/contributing.rst index fbb2c08..47858b4 100644 --- a/docs/contributing.rst +++ b/docs/contributing.rst @@ -75,7 +75,7 @@ If you have Docker available on your platform, you can get started building CSS When building with Docker, we create an image containing the build dependencies. Some of these are quite outdated and therefore ideal to isolate a container. The image is tagged as ``sphinx_rtd_theme:latest``. -Inside the running docker image, we mount the working copy of the repository, build the artifacts and finally copy out those artifacts into your external environment. +Inside the running docker image, we mount the working copy of the repository, build the artifacts and finally observe that the artifacts have been built and left in your current git checkout. Use the following steps: @@ -90,9 +90,6 @@ Use the following steps: # Runs the development webserver $ make docker-run command=dev - # Copies out the assets from the most recent docker-run - $ make docker-copy-assets - Every time you change the Node or Python requirements, you will need to rebuild images with ``make docker-images``. If you change SASS or JS, you will need to rebuild assets. |