Skip to content
This repository has been archived by the owner on Jul 8, 2020. It is now read-only.

[WIP] Reduce run layers, fix linter errors #1

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

justinribeiro
Copy link

@justinribeiro justinribeiro commented May 2, 2017

This is first pass to reduce some of the layers in the docker build process to help reduce build problems. In particular we don't want to use sudo and we don't want to run apt-get upgrade.

This currently builds and runs, but I'll probably work on this pull some more before it might be considered for merge.

Copy link
Contributor

@ebidel ebidel 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 cleanup. We should strike a balance of reducing bloat but also making a Docker file for noobs that's easy to follow.

Left some initial comments. What more do you thin we can do?

# Install utilities
RUN apt-get update && apt-get install -y $deps \
--no-install-recommends \
&& curl -sSL https://deb.nodesource.com/setup_6.x | bash - \
Copy link
Contributor

Choose a reason for hiding this comment

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

This is getting gnarly. Can we keep the && on the previous lines so it's easier to parse each command?

Copy link
Author

Choose a reason for hiding this comment

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

The && style on the bottom line is the notation in the Best Practices doc (https://docs.docker.com/engine/userguide/eng-image/dockerfile_best-practices/), but the && on previous line is a-okay by me. It's on my list to make consistent in this PR.

&& echo "deb [arch=amd64] https://dl.google.com/linux/chrome/deb/ stable main" > /etc/apt/sources.list.d/google-chrome.list \
&& apt-get update && apt-get install -y \
google-chrome-stable \
nodejs \
Copy link
Contributor

Choose a reason for hiding this comment

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

apt-get install -y google-chrome-stable nodejs --no-install-recommends on it's own line

Copy link
Author

Choose a reason for hiding this comment

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

This is just the style in the RUN section (see https://docs.docker.com/engine/userguide/eng-image/dockerfile_best-practices/#run), I've used both in practice. Can go single.

Copy link
Contributor

Choose a reason for hiding this comment

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

That's cool. Then, let's stick w/ Docker's style.

nodejs \
--no-install-recommends \
&& npm --global install yarn \
&& apt-get purge --auto-remove -y curl gnupg \
Copy link
Contributor

Choose a reason for hiding this comment

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

can you add comments on these last two lines?

Copy link
Author

Choose a reason for hiding this comment

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

👍

sudo adduser chromeuser sudo
# Add Chrome as a user
RUN groupadd -r chrome && useradd -r -g chrome -G audio,video chrome \
&& mkdir -p /home/chrome/Downloads && chown -R chrome:chrome /home/chrome
Copy link
Contributor

Choose a reason for hiding this comment

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

why do we need mkdir -p /home/chrome/Downloads?

Copy link
Author

Choose a reason for hiding this comment

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

That's my bad; we won't need downloads in this case. Will remove.

@justinribeiro
Copy link
Author

Agreed; the balance needs to be there and I believe I can make this a little more cleaner for people just coming into it. Should have some time this evening, I'll push another commit with revisions for you to have a look at.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants