update commands

This commit is contained in:
Mayel 2020-09-17 12:44:25 +02:00
parent 6613ef3a6e
commit 9b2613598a
4 changed files with 26 additions and 15 deletions

View file

@ -24,4 +24,4 @@ RUN apk add cmake make gcc libc-dev
EXPOSE 4000/tcp
EXPOSE 4004/tcp
CMD ["sh","-c","mix local.hex --force && mix local.rebar --force && mix setup && iex -S mix phx.server"]
CMD ["sh","-c","iex -S mix phx.server"]

View file

@ -1,13 +1,16 @@
.PHONY: deps clean-deps update-deps
.PHONY: setup updates db-reset build dev
update-deps:
mix deps.update pointers \
cpub_accounts cpub_blocks cpub_characters cpub_emails \
cpub_local_auth cpub_profiles cpub_users
mix-%: ## Run a specific mix command in Docker Dev, eg: `make mix-deps.get` or make mix-deps.update args="pointers"
docker-compose run web mix $* $(args)
clean-deps:
mix deps.clean pointers \
cpub_accounts cpub_blocks cpub_characters cpub_emails \
cpub_local_auth cpub_profiles cpub_users --build
setup: build mix-setup ## First run - prepare Docker Dev environment and dependencies
deps: update-deps clean-deps
updates: build mix-updates ## Update/prepare Docker Dev dependencies
db-reset: mix-ecto.reset ## Reset the DB
build: ## Build the docker image
docker-compose build
dev: ## Run the app with Docker
docker-compose run --service-ports web

View file

@ -4,9 +4,11 @@ Blogging/Microblogging software.
## Handy commands
* `make update-deps` - updates commonspub dep versions
* `make clean-deps` - cleans the compiled deps so config is reread
* `make deps` - both of the above
* `mix cpub.deps.update` - updates commonspub dep versions
* `mix cpub.deps.clean` - cleans the compiled deps so config is reread
* `mix cpub.deps` - both of the above
If using Docker, just replace `mix ` with `make mix-` in the above commands, so for example `mix cpub.deps` becomes `make mix-cpub.deps`.
## Copyright and License

View file

@ -32,9 +32,15 @@ defmodule VoxPublica.MixProject do
defp aliases do
[
"hex.setup": ["local.hex --force"],
"rebar.setup": ["local.rebar --force"],
"js.deps.get": ["cmd npm install --prefix assets"],
"ecto.seeds": ["run priv/repo/seeds.exs"],
setup: ["deps.get", "ecto.setup", "js.deps.get"],
"cpub.deps.update": ["deps.update pointers cpub_accounts cpub_blocks cpub_characters cpub_emails cpub_local_auth cpub_profiles cpub_users"],
"cpub.deps.clean": ["deps.clean pointers cpub_accounts cpub_blocks cpub_characters cpub_emails cpub_local_auth cpub_profiles cpub_users --build"],
"cpub.deps": ["cpub.deps.update", "cpub.deps.clean"],
setup: ["hex.setup", "rebar.setup", "deps.get", "cpub.deps.clean", "ecto.setup", "js.deps.get"],
updates: ["deps.get", "cpub.deps.clean", "ecto.migrate", "js.deps.get"],
"ecto.setup": ["ecto.create", "ecto.migrate", "ecto.seeds"],
"ecto.reset": ["ecto.drop", "ecto.setup"],
test: ["ecto.create --quiet", "ecto.migrate --quiet", "test"]