Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce Docker image #164

Merged
merged 1 commit into from Feb 15, 2019
Merged

Reduce Docker image #164

merged 1 commit into from Feb 15, 2019

Conversation

duduribeiro
Copy link
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 Feb 14, 2019 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
.dockerignore Show resolved Hide resolved
rafapg
rafapg approved these changes Feb 15, 2019
@duduribeiro duduribeiro merged commit 1e74d9e into master Feb 15, 2019
3 checks passed
@duduribeiro duduribeiro deleted the reduce_docker_image branch Feb 15, 2019
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.

None yet

4 participants