I have python script inside container which needs two arguments to run. I tried to run the script using Makefile.
For this I made make command:
.PHONY: deploy
deploy:
@docker exec -it ecosystem python3 deployment/deploy.py $(filter-out $@,$(MAKECMDGOALS))
When I run make deploy server project
, the script works, but when it finishes I get the following error: make: *** No rule to make target 'server'. Stop.
The command line of make is reserved for use by make. You don't get to use it for your own alternative purposes. Every word on the command line must be either an option or option argument, or a variable assignment, or a target to be built.
When you type make deploy server project
you're telling make to build three targets: deploy
, server
, and project
.
You can't change this. Make is not a general-purpose scripting language like Python or Perl or even the shell.
You could do it like this instead:
.PHONY: deploy
DEPLOY_ARGS =
deploy:
@docker exec -it ecosystem python3 deployment/deploy.py $(DEPLOY_ARGS)
then run:
make deploy DEPLOY_ARGS='server project'