-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
use ADD to reduce docker image sizes #7537
Conversation
airbyte-scheduler/app/Dockerfile
Outdated
COPY build/distributions/${APPLICATION}-0*.tar ${APPLICATION}.tar | ||
|
||
RUN tar xf ${APPLICATION}.tar --strip-components=1 | ||
ADD build/distributions/${APPLICATION}-0*.tar /app |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not related to your PR but why do we hav -0*. in the tar path. It will break when we will switch the major version to 1.
On another point could you ping me when this will get merge since I am working on those file at the moment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@benmoriceau PTAL. I'm thinking we can add this to each of the projects. If we add this to all of the projects, #1605 will be resolved as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Other apps might benefits from that (migration for example) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice!
COPY build/distributions/${APPLICATION}-0*.tar ${APPLICATION}.tar | ||
|
||
RUN tar xf ${APPLICATION}.tar --strip-components=1 | ||
ADD build/distributions/${APPLICATION}-0.30.23-alpha.tar /app |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just curious, would we get the same effect if we deleted the tar archive after running tar xf?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe that combined with multistage builds, but just doing that directly still keeps the separate layers which are still part of the image and downloaded.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
double checking this doesn't make it harder to pull in dev changes.
my understanding is we always build the tar named at the current version, regardless of dev or not, so this doesn't affect our current problem where we run into gradle caching when trying to build dev
, where older versions are pulled in as the build task is cached.
so this should be an okay change. is this right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that's right.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we do change how that's done we may need to inject a VERSION
environment variable here, but since it works for both dev and normal versions now, I'm inclined to leave it as-is until we get to that point. It should obviously fail on CI if this becomes in a problem so I feel like it's pretty safe.
* use ADD to reduce docker image sizes * switch to full paths
* use ADD to reduce docker image sizes * switch to full paths
Goes from:
to
by utilizing the tar extraction
ADD
feature.see https://airbytehq.slack.com/archives/C019WEENQRM/p1635686411078800 for more context.