-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
@ #13 | should support Docker workflow
- Loading branch information
Showing
5 changed files
with
111 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -51,6 +51,14 @@ For deploying with heroku only. | |
|
||
For auto-building the documentation when a change is detected thanks to https://pypi.org/project/sphinx-autobuild/ | ||
|
||
**10. `$ make build_docker_image`** | ||
|
||
To build the production docker image for the docs site, for example: | ||
|
||
``` | ||
$ make build_docker_image DOCKER_IMG_TAG=company/project-docs:develop | ||
``` | ||
|
||
|
||
Installation | ||
------------ | ||
|
@@ -105,6 +113,27 @@ c.. To build with `travis-ci`, you need to copy these following files to your ro | |
- `.travis/setup.sh` | ||
|
||
|
||
Auto-build with docker-compose | ||
------------------------------ | ||
|
||
Make sure `docker` and `docker-compose` are installed and running. | ||
|
||
```bash | ||
$ docker-compose up -d | ||
$ echo open http://localhost:`docker port docs_docs_1 80 | grep -o [0-9]*$` to view the docs | ||
open http://localhost:32770 to view the docs | ||
``` | ||
|
||
Check the output from the command above to open the docs site. The docs site will auto reload when | ||
changes are made to the docs files. | ||
|
||
To see the docs site logs, execute the following command: | ||
|
||
```bash | ||
$ docker-compose logs -f docs | ||
``` | ||
|
||
|
||
Configuration | ||
------------- | ||
|
||
|
@@ -186,6 +215,12 @@ ifndef REPO_URL_HEROKU | |
# REPO_URL_HEROKU = [email protected]:spxd.git | ||
endif | ||
|
||
## -- Docker Config -- ## | ||
|
||
ifndef DOCKER_IMG_TAG | ||
# Configure your default docker image tag | ||
DOCKER_IMG_TAG = sphinx-deployment/docs:develop | ||
endif | ||
|
||
## end deployment configuration, don't edit anything below this line ## | ||
####################################################################### | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
ARG PYTHON_VERSION=3.6 | ||
ARG NGINX_VERSION=1.13 | ||
|
||
#building | ||
FROM python:$PYTHON_VERSION as builder | ||
|
||
RUN mkdir -p /opt/app | ||
|
||
ENV TERM=xterm-256color APP=/opt/app | ||
|
||
WORKDIR $APP | ||
|
||
ADD requirements.txt $APP/ | ||
|
||
RUN pip install -r requirements.txt | ||
|
||
ADD . $APP | ||
|
||
RUN make html | ||
|
||
# packaging | ||
FROM nginx:$NGINX_VERSION | ||
|
||
LABEL authors="hoatle <[email protected]>" | ||
|
||
RUN mkdir -p /opt/app | ||
|
||
ENV TERM=xterm APP=/opt/app | ||
|
||
WORKDIR $APP | ||
|
||
# add more arguments from CI to the image so that `$ env` should reveal more info | ||
ARG CI_BUILD_ID | ||
ARG CI_BUILD_REF | ||
ARG CI_REGISTRY_IMAGE | ||
ARG CI_BUILD_TIME | ||
|
||
ENV CI_BUILD_ID=$CI_BUILD_ID CI_BUILD_REF=$CI_BUILD_REF CI_REGISTRY_IMAGE=$CI_REGISTRY_IMAGE \ | ||
CI_BUILD_TIME=$CI_BUILD_TIME | ||
|
||
COPY --from=builder /opt/app/_build/html /usr/share/nginx/html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
version: '3' | ||
|
||
services: | ||
|
||
# how to use: | ||
# $ docker-compose up -d | ||
# $ echo open http://localhost:`docker port docs_docs_1 80 | grep -o [0-9]*$` to view the docs | ||
# open http://localhost:32770 to view the docs | ||
docs: | ||
image: python:3.6 | ||
working_dir: /opt/app | ||
command: sh run-dev.sh | ||
restart: unless-stopped | ||
ports: | ||
- "80" | ||
volumes: | ||
- .:/opt/app |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/bin/bash | ||
|
||
pip install -r requirements.txt | ||
|
||
make livehtml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters