Coding-Coach / coding-coach-api

62 stars 39 forks source link

Optimize docker build by using a builder image #23

Closed frederikprijck closed 6 years ago

frederikprijck commented 6 years ago

I tried giving a first stab on the docker optimization issue. Currently, the docker image doesn't work as https://github.com/Coding-Coach/coding-coach-api/pull/22 isn't merged yet. Once https://github.com/Coding-Coach/coding-coach-api/pull/22 is merged I'll rebuild the image locally to verify it's working as expected.

jagzviruz commented 6 years ago

@frederikprijck - #22 is now merged. Please proceed with verifying these change. Do we need to copy all files in the project folder into the Docker image ?

frederikprijck commented 6 years ago

It's only the builder, but i can exclude some files, making the dockerfile bigger (when it comes to the number of lines in the dockerfile). But this shouldn't impact the actual docker image used to run the api. The benefit of copying everything is that you shouldn't worry about including future files.

The actual docker image will only contain the dist folder and the production dependencies.

22 isn't merged afaict.

jagzviruz commented 6 years ago

ahh sorry.. #21 was merged. merging #22 now.

frederikprijck commented 6 years ago

Awesome, ill ping you once ive updated the pr.

frederikprijck commented 6 years ago

@jagzviruz I've rebased unto development and running docker-compose up works fine now. I've also added a .dockerignore file to exclude node_modules when using COPY . ..