2023-03-23 17:46:56 +03:00
|
|
|
UID := $(shell id -u)
|
|
|
|
GID := $(shell id -g)
|
|
|
|
export UID
|
|
|
|
export GID
|
|
|
|
|
2019-02-13 18:21:05 +03:00
|
|
|
.PHONY: help_redirect
|
2017-06-15 11:41:40 +03:00
|
|
|
help_redirect:
|
|
|
|
@$(MAKE) help --no-print-directory
|
|
|
|
|
2019-02-13 18:21:05 +03:00
|
|
|
.PHONY: help_submake
|
2017-06-15 11:41:40 +03:00
|
|
|
help_submake:
|
2019-08-29 14:10:25 +03:00
|
|
|
@echo "Host only commands:"
|
2019-08-29 16:34:26 +03:00
|
|
|
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' Makefile-os | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
|
|
|
|
@echo "\nAll other commands will be passed through to the docker 'web' container make:"
|
2019-08-29 14:10:25 +03:00
|
|
|
@make -f Makefile-docker help_submake
|
2017-06-15 11:41:40 +03:00
|
|
|
|
2019-02-13 18:21:05 +03:00
|
|
|
.PHONY: update_docker
|
2019-08-29 16:34:26 +03:00
|
|
|
update_docker: ## update all the docker images
|
2023-03-23 17:46:56 +03:00
|
|
|
docker-compose exec --user olympia worker make update_deps
|
|
|
|
docker-compose exec --user olympia web make update
|
2018-02-19 19:07:34 +03:00
|
|
|
docker-compose restart web
|
|
|
|
docker-compose restart worker
|
2017-06-15 11:41:40 +03:00
|
|
|
|
2019-02-13 18:21:05 +03:00
|
|
|
.PHONY: shell
|
2019-08-29 16:34:26 +03:00
|
|
|
shell: ## connect to a running addons-server docker shell
|
2023-03-23 17:46:56 +03:00
|
|
|
docker-compose exec --user olympia web bash
|
2017-06-15 11:41:40 +03:00
|
|
|
|
2023-03-23 17:46:56 +03:00
|
|
|
.PHONY: rootshell
|
2019-10-22 12:24:05 +03:00
|
|
|
rootshell: ## connect to a running addons-server docker shell with root user
|
|
|
|
docker-compose exec --user root web bash
|
|
|
|
|
2023-03-23 17:46:56 +03:00
|
|
|
.PHONY: create_env_file
|
|
|
|
create_env_file:
|
|
|
|
echo "UID=${UID}\nGID=${GID}" > .env
|
|
|
|
|
|
|
|
.PHONY: initialize_docker
|
|
|
|
initialize_docker: create_env_file
|
|
|
|
# Run a fresh container from the base image to install deps. Since /deps is
|
|
|
|
# shared via a volume in docker-compose.yml, this installs deps for both web
|
|
|
|
# and worker containers, and does so without requiring the containers to be up.
|
|
|
|
# We just create dummy empty package.json and package-lock.json in deps/ so
|
|
|
|
# that docker-compose doesn't create dummy ones itself, as they would be owned
|
|
|
|
# by root. They don't matter: the ones at the root directory are mounted
|
|
|
|
# instead.
|
|
|
|
touch deps/package.json
|
|
|
|
touch deps/package.json
|
|
|
|
# Note that this is running with --user ${UID}:${GID} because the user olympia
|
|
|
|
# would be uid 9500 regardless of host at this point (this is only fixed when
|
|
|
|
# the container is up, through the command defined in docker-compose.yml),
|
|
|
|
# which is wrong for local development.
|
|
|
|
docker-compose run --rm --user ${UID}:${GID} web make update_deps
|
|
|
|
docker-compose up -d
|
|
|
|
docker-compose exec --user olympia web make initialize
|
|
|
|
|
2019-08-29 14:40:25 +03:00
|
|
|
%: ## This directs any other recipe (command) to the web container's make.
|
2023-03-23 17:46:56 +03:00
|
|
|
docker-compose exec --user olympia web make $(MAKECMDGOALS) ARGS=$(ARGS)
|
2019-08-05 12:44:29 +03:00
|
|
|
|
2019-08-29 14:10:25 +03:00
|
|
|
# You probably want to put new commands in Makefile-docker, unless they operate
|
|
|
|
# on multiple containers or are host-os specific.
|