-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
17 additions
and
57 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
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
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 |
---|---|---|
@@ -1,37 +1,17 @@ | ||
# VERSION=1.0.0 | ||
# VERSION=2.0.0 | ||
# Docker related stuff | ||
# use wheelhouse/requirements.txt as the sentinal so make | ||
# knows whether it needs to rebuild the wheel directory or not | ||
# has the added advantage that it can just pip install | ||
# from that later on as well | ||
|
||
ROOT_DIR:=$(shell dirname $(realpath $(lastword $(MAKEFILE_LIST)))) | ||
WHEELHOUSE ?= wheelhouse | ||
ORG ?= ccnmtl | ||
BUILDER_IMAGE ?= ccnmtl/django.build | ||
# Start up docker dev server with docker-compose | ||
docker: | ||
docker compose up | ||
|
||
# make it easy to override the docker image created. eg: | ||
# REGISTRY=localhost:5000/ TAG=release-5 make build | ||
# to make an image 'localhost:5000/ccnmtl/app:release-5' | ||
# defaults to docker hub (ie, no registry specified) and no tag. | ||
# Enter a command-line shell in the web container | ||
docker-shell: | ||
docker compose run web bash | ||
|
||
ifeq ($(origin TAG), undefined) | ||
IMAGE ?= $(REGISTRY)$(ORG)/$(APP) | ||
else | ||
IMAGE ?= $(REGISTRY)$(ORG)/$(APP):$(TAG) | ||
endif | ||
# Enter an interactive django shell | ||
docker-django-shell: | ||
docker compose run web python manage.py shell_plus \ | ||
--settings=$(APP).settings_docker | ||
|
||
$(WHEELHOUSE)/requirements.txt: $(REQUIREMENTS) | ||
mkdir -p $(WHEELHOUSE) | ||
docker run --rm \ | ||
-v $(ROOT_DIR):/app \ | ||
-v $(ROOT_DIR)/$(WHEELHOUSE):/wheelhouse \ | ||
$(BUILDER_IMAGE) | ||
cp $(REQUIREMENTS) $@ | ||
touch $@ | ||
|
||
# Run this target to rebuild the django image | ||
build: $(WHEELHOUSE)/requirements.txt | ||
docker build -t $(IMAGE) . | ||
|
||
.PHONY: build | ||
.PHONY: docker docker-shell docker-django-shell |
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