3 ms·
Say you wrote your 10 lines script that mocks your third party endpoint. running it on port 7659 is > php -S 0.0.0.0:7659 scripts/test.php and done. Compare
by hrktb 6y ago
Say you wrote your 10 lines script that mocks your third party endpoint.
running it on port 7659 is
> php -S 0.0.0.0:7659 scripts/test.php
and done.
Compared to this one liner, the proposition is making a dockerfile with a base image, perhaps your local extensions if you had to compile them, and configuration if you changed from the default one.
Then a docker-compose to share your local file, which references the previous Dockerfile, and specifies the right port. Knowing if your testfile is not self contained, you’d need to map any services it needs to access to.
Then you run the whole.
It is by no mean complicated, and you could keep around a template of all of that around in case you need it (or you copy it from your main application’s docker files, and modify if you need to it more lax). As you say it also gives you more freedom. It’s just a tad more tedious than literally one line.
- paledot 6y agoThat's a fair use case, although I might still wrap that one-liner in a Docker container because the service consuming the mock is probably Dockerized. But indeed it doesn't make sense to configure and run another nginx container just for that 10-line mock.