Docker - Optimize for development through Docker environment #299
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I do not like running things locally.
As a result, I cleaned up the Dockerfile to have a production and development build steps that can be targeted. The production build is the same as before, while the development build has all development dependencies installed and runs
vue-cli-service serve --port 8082
by default.While I was at it, I also added some Dockerfile arguments for the node and alpine versions.
Since the Dockerfile now has a production and development build, you have to target the production step explicitly. If you don't, the development build will be produced. To help with that, I added a Makefile with rules for building production and development images. I also added rules for starting and removing the docker environment as defined in the docker/docker-compose.yml file.
I also made sure to update the
docker/build-push-action@v3
workflow action to target the production build step.See: https://github.com/docker/build-push-action?tab=readme-ov-file#inputs
I wasn't able to test if this
target
field works as expected, so that's something that has to be verified.I did test the image building and running for both production and development targets.