Changeset View
Standalone View
Makefile
ALL_DOCKERFILES := $(wildcard dockerfiles/Dockerfile-*) | ALL_DOCKERFILES := $(wildcard dockerfiles/Dockerfile-*) | ||||
ALL_BUILD_TARGETS := $(subst dockerfiles/Dockerfile-,build-,$(ALL_DOCKERFILES)) | ALL_BUILD_TARGETS := $(subst dockerfiles/Dockerfile-,build-,$(ALL_DOCKERFILES)) | ||||
all: $(ALL_BUILD_TARGETS) | build: $(ALL_BUILD_TARGETS) | ||||
vlorentz: Why did you rename it? It's common for the first make target to be called `all`. (And having a… | |||||
ardumontAuthorUnsubmitted Done Inline ActionsI fight on speed and somehow mixed stuff. ardumont: I fight on speed and somehow mixed stuff.
Changing that. | |||||
run: $(ALL_BUILD_TARGETS) | clean: | ||||
# Discard existing volumes | # Discard existing volumes | ||||
docker-compose down --volumes | docker-compose down --volumes | ||||
Not Done Inline ActionsJust repeat docker-compose up, it's better than calling make from itself vlorentz: Just repeat `docker-compose up`, it's better than calling make from itself | |||||
Not Done Inline ActionsAlso, I wouldn't expect a target named rebuild to actually run the stuff. Maybe rename it to clean-run`? vlorentz: Also, I wouldn't expect a target named `rebuild` to actually run the stuff. Maybe rename it to… | |||||
Done Inline Actions
Right.
Yes. clean: docker-compose down --volumes People who wants to do that can then do: make clean build run that's cleaner and expected, what do you think? ardumont: > Just repeat docker-compose up, it's better than calling make from itself
Right.
> Also, I… | |||||
Done Inline Actionsor up and down (vagrant users would not be disturbed, vagrant up and vagrant down are used there ;) ardumont: or `up` and `down` (vagrant users would not be disturbed, `vagrant up` and `vagrant down` are… | |||||
Not Done Inline Actionsrun must depend on build. vlorentz: `run` must depend on `build`. | |||||
Done Inline ActionsI don't see why we should need to have that here. make run will systematically trigger a build even though nothing changed. I'd be more for having to trigger make build run the first time (and when we need to change something). If you have noise in the swh-environment (and some people have), that slows all the damn things. I added the .dockerignore in swh-environment: */*.git **/*.pyc */.tox */.hypothesis swh-web/node_modules !swh-web/.git .venv/ packages/ (not in that repository as that does not work either). and it helped a little but that was not enough (i still had noise to cleanup...). ardumont: I don't see why we should need to have that here.
make run will systematically trigger a build… | |||||
Done Inline Actionsfor the .dockerignore, i've opened a D807 for it btw (for completeness' sake) ardumont: for the .dockerignore, i've opened a D807 for it btw (for completeness' sake) | |||||
Not Done Inline Actions
Because building is a dependency of running.
Yes, but Docker caches intermediate images, so it won't actually have to rebuild it.
There is no guarantee that build will run before run vlorentz: > I don't see why we should need to have that here.
Because building is a dependency of… | |||||
run: | |||||
# Runs containers in the foreground | # Runs containers in the foreground | ||||
docker-compose up | docker-compose up | ||||
build-%: dockerfiles/Dockerfile-% | build-%: dockerfiles/Dockerfile-% | ||||
@echo "" | @echo "" | ||||
@echo "+----------------------------------------------------+" | @echo "+----------------------------------------------------+" | ||||
@printf '| %-50s |\n' "Building $(subst build-,,$@)" | @printf '| %-50s |\n' "Building $(subst build-,,$@)" | ||||
@echo "+----------------------------------------------------+" | @echo "+----------------------------------------------------+" | ||||
@echo "" | @echo "" | ||||
docker build -f $< -t $(subst build-,,$@) $(BUILD_CONTEXT) .. | docker build -f $< -t $(subst build-,,$@) $(BUILD_CONTEXT) .. |
Why did you rename it? It's common for the first make target to be called all. (And having a target named build is kind of redundant, as Make's job is to build stuff)