Skip to content

Commit 6529fa5

Browse files
committed
Makes docs builds faster and ensures proper ownership
Signed-off-by: Frank Sachsenheim <[email protected]>
1 parent f127a9f commit 6529fa5

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

.dockerignore

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,4 @@ html/*
1313
__pycache__
1414

1515
# Compiled Documentation
16-
site/
17-
Makefile
16+
docs/_build

Dockerfile-docs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
FROM python:3.5
22

3-
RUN mkdir /src
4-
WORKDIR /src
3+
ARG uid=1000
4+
ARG gid=1000
55

6-
COPY requirements.txt /src/requirements.txt
7-
RUN pip install -r requirements.txt
6+
RUN addgroup --gid $gid sphinx \
7+
&& useradd --uid $uid --gid $gid -M sphinx
88

9-
COPY docs-requirements.txt /src/docs-requirements.txt
10-
RUN pip install -r docs-requirements.txt
9+
WORKDIR /src
10+
COPY requirements.txt docs-requirements.txt ./
11+
RUN pip install -r requirements.txt -r docs-requirements.txt
1112

12-
COPY . /src
13+
USER sphinx

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ build-py3:
1616

1717
.PHONY: build-docs
1818
build-docs:
19-
docker build -t docker-sdk-python-docs -f Dockerfile-docs .
19+
docker build -t docker-sdk-python-docs -f Dockerfile-docs --build-arg uid=$(shell id -u) --build-arg gid=$(shell id -g) .
2020

2121
.PHONY: build-dind-certs
2222
build-dind-certs:
@@ -77,7 +77,7 @@ flake8: build
7777

7878
.PHONY: docs
7979
docs: build-docs
80-
docker run --rm -it -v `pwd`:/code docker-sdk-python-docs sphinx-build docs ./_build
80+
docker run --rm -it -v `pwd`:/src docker-sdk-python-docs sphinx-build docs docs/_build
8181

8282
.PHONY: shell
8383
shell: build

0 commit comments

Comments
 (0)