-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathMakefile
55 lines (41 loc) · 1.85 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
IMAGE_VERSION ?= latest
DIR=$(shell pwd)
SECTION ?= index
HOST_UID = `id -u`
HOST_GID = `id -g`
docker-build:
docker build -t bamx/api-docs:${IMAGE_VERSION} conf
docker-pull:
docker pull bamx/api-docs:${IMAGE_VERSION}
docker-pull-latest:
docker pull bamx/api-docs:latest
docker-push:
docker push bamx/api-docs:${IMAGE_VERSION}
docker-push-latest:
docker push bamx/api-docs:latest
docker-tag-latest:
docker tag bamx/api-docs:${IMAGE_VERSION} bamx/api-docs:latest
# Shortcut for generating sphinx documentation in the most commonly-used formats
docker-sphinx: docker-sphinx-html docker-sphinx-singlehtml
# Run an arbitrary sphinx make target in the docker container. Examples:
# make docker-sphinx-clean
# make docker-sphinx-html
docker-sphinx-%:
docker run -v `pwd`/docs:/opt/bamx/docs --workdir /opt/bamx/docs --rm bamx/api-docs make $*
# Open file for preview in Chrome: make preview SECTION=smartlink
# SECTION: name of the rst file
preview:
bash -c "open -a Google\ Chrome ${DIR}/docs/_build/html/${SECTION}.html"
sh:
docker run -it --rm bamx/api-docs sh
######################################
# Pip Tools
######################################
pip-compile:
docker run -it --rm -v "${DIR}/conf:/opt/bamx/conf" "bamx/api-docs:${IMAGE_VERSION}" /bin/sh -c \
"pip-compile --rebuild --generate-hashes --output-file conf/requirements.txt conf/unpinned-requirements.txt && chown ${HOST_UID}:${HOST_GID} conf/requirements.txt"
# The --allow-unsafe flag is arguably more safe to include than to omit.
# See https://github.com/jazzband/pip-tools/issues/806 for details
pip-upgrade:
docker run -it --rm -v "${DIR}/conf:/opt/bamx/conf" "bamx/api-docs:${IMAGE_VERSION}" /bin/sh -c \
"pip-compile --upgrade --rebuild --generate-hashes --allow-unsafe --output-file conf/requirements.txt conf/unpinned-requirements.txt && chown ${HOST_UID}:${HOST_GID} conf/requirements.txt"