Skip to content

Conversation

@taliesins
Copy link
Contributor

Optimize build image size
Upgrade to latest dependencies

@promptws
Copy link

View a preview at https://prompt.ws/r/Azure/azure-cli/5611
This is an experimental preview for @microsoft users.

@troydai troydai requested a review from derekbekoe February 20, 2018 17:28
Copy link
Contributor

@troydai troydai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the contribution. Please see the comments for suggested changes.

Dockerfile Outdated
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since the essence of this change is to combine all the installation commands in one RUN so as to reduce the number of layers, it would be nice to also gather all the comments and put them ahead of the RUN command instead of spreading them between the lines.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Surely it is way more useful to see comments in close proximity to the code it is commenting on?

I would rather remove the comments then move them into one large uber comment.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you can remove the comments.

Dockerfile Outdated
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style: align all the lines here by adding the same indentation.

.dockerignore Outdated
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

requirements.txt shouldn't be needed for the Docker build so I agree with Troy. No need for this particular change.

Copy link
Member

@derekbekoe derekbekoe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution.
Added some comments.

.dockerignore Outdated
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

requirements.txt shouldn't be needed for the Docker build so I agree with Troy. No need for this particular change.

Dockerfile Outdated
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to install requirements.txt.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could by my python noobness, but I though the intention of the requirements.txt file was similar to packages.config for nuget.

If almost all python projects follow this approach, why do this one differently?

Dockerfile Outdated
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change to JP_VERSION. It's not always going to be the latest.

Dockerfile Outdated
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why remove the pyc files?
They'll likely be created again on first run and may slow down first run performance.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are correct. It will run quicker if we don't delete pyc files.

I guess as we are doing "phoenix builds" and the bytecode is python vm dependent (which is not going to change) we are fine to leave the pyc files in place.

On the other hand if you do delete .pyc and .pyo files, you get smaller docker size and are not executing arbitrary bytecode (someone might slip in a dodgy pyc file)

Dockerfile Outdated
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does this do?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this installs apk packages that are required for runtime.

http://wiki.alpinelinux.org/wiki/Creating_an_Alpine_package

After the package is successfully compiled and created we should make sure it didn't link to any package that is not present in the $depends variable. We do this by using scanelf.

Upgrade to latest dependencies
@troydai
Copy link
Contributor

troydai commented May 8, 2018

@derekbekoe @taliesins I made additional changes to resolve the conflict. Please take a look and we should get this merged.

@taliesins
Copy link
Contributor Author

Perhaps a rebase? 350000 changes could be troublesome to review.

Would be nice to get this merged in 😀

@derekbekoe
Copy link
Member

@taliesins I did some verification and it looks good. Thanks for the change.
@troydai can you review also?

@troydai troydai merged commit 666b14a into Azure:dev May 8, 2018
| xargs -r apk info --installed \
| sort -u \
)" \
&& apk add --virtual .rundeps $runDeps \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line makes no sense if we don't remove .rundeps later?

While cmd:, so: and pc: packages are automatically created virtuals, you can create your own as well. These allow for quick removal of purpose-specific packages. -- https://docs.alpinelinux.org/user-handbook/0.1a/Working/apk.html#_virtuals

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.

5 participants