Skip to content

Reduce Docker image#164

Merged
duduribeiro merged 1 commit into
masterfrom
reduce_docker_image
Feb 15, 2019
Merged

Reduce Docker image#164
duduribeiro merged 1 commit into
masterfrom
reduce_docker_image

Conversation

@duduribeiro
Copy link
Copy Markdown
Member

@duduribeiro duduribeiro commented Feb 14, 2019

This commit reduce the final image size from 964MB to 272MB through:

  • Using multi-stage build
  • Remove unecessary files using .dockerignore file
  • Remove unecessary files after installing dependencies

before:
large_image

after:
reduced_2_image

For production, it is also possible to remove some files that it is not
necessary for it (like tests, uncompiled assets, etc) using the
to_remove argument, for example:

--build-arg to_remove="spec node_modules app/assets vendor/assets
lib/assets tmp/cache".

This reduce the final image to 164MB

reduced_3_production

@duduribeiro duduribeiro temporarily deployed to openjobs-staging-pr-164 February 14, 2019 19:40 Inactive
This commit reduce the final image size from 964MB to 272MB through:
- Using multi-stage build
- Remove unecessary files using .dockerignore file
- Remove unecessary files after installing dependencies

For production, it is also possible to remove some files that it is not
necessary for it (like tests, uncompiled assets, etc) using the
`to_remove` argument, for example:

--build-arg to_remove="spec node_modules app/assets vendor/assets \
lib/assets tmp/cache".

This reduce the final image to 164MB
Comment thread .dockerignore
@duduribeiro duduribeiro merged commit 1e74d9e into master Feb 15, 2019
@duduribeiro duduribeiro deleted the reduce_docker_image branch February 15, 2019 14:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants