-
Notifications
You must be signed in to change notification settings - Fork 250
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
Refactor Dockerfile to reduce the amount of layers #701
base: main
Are you sure you want to change the base?
Refactor Dockerfile to reduce the amount of layers #701
Conversation
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.
Hopeful this change can get looked at, just started testing migrating my agents to alloy and CI flagged the amount of wasted space in the image build.
RUN groupadd --gid $UID $USERNAME | ||
RUN useradd -m -u $UID -g $UID $USERNAME | ||
RUN chown -R $USERNAME:$USERNAME /etc/alloy | ||
RUN chown -R $USERNAME:$USERNAME /bin/alloy | ||
RUN groupadd --gid $UID $USERNAME \ | ||
&& useradd -m -u $UID -g $UID $USERNAME \ | ||
&& chown -R $USERNAME:$USERNAME /etc/alloy \ | ||
&& chown -R $USERNAME:$USERNAME /bin/alloy \ | ||
|
||
&& mkdir -p /var/lib/alloy/data \ | ||
&& chown -R $USERNAME:$USERNAME /var/lib/alloy \ | ||
&& chmod -R 770 /var/lib/alloy | ||
|
||
RUN mkdir -p /var/lib/alloy/data | ||
RUN chown -R $USERNAME:$USERNAME /var/lib/alloy | ||
RUN chmod -R 770 /var/lib/alloy | ||
|
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.
I'd remove the line break and indent 2 more spaces, looks a bit cleaner IMO.
RUN groupadd --gid $UID $USERNAME | |
RUN useradd -m -u $UID -g $UID $USERNAME | |
RUN chown -R $USERNAME:$USERNAME /etc/alloy | |
RUN chown -R $USERNAME:$USERNAME /bin/alloy | |
RUN groupadd --gid $UID $USERNAME \ | |
&& useradd -m -u $UID -g $UID $USERNAME \ | |
&& chown -R $USERNAME:$USERNAME /etc/alloy \ | |
&& chown -R $USERNAME:$USERNAME /bin/alloy \ | |
&& mkdir -p /var/lib/alloy/data \ | |
&& chown -R $USERNAME:$USERNAME /var/lib/alloy \ | |
&& chmod -R 770 /var/lib/alloy | |
RUN mkdir -p /var/lib/alloy/data | |
RUN chown -R $USERNAME:$USERNAME /var/lib/alloy | |
RUN chmod -R 770 /var/lib/alloy | |
RUN groupadd --gid $UID $USERNAME \ | |
&& useradd -m -u $UID -g $UID $USERNAME \ | |
&& chown -R $USERNAME:$USERNAME /etc/alloy \ | |
&& chown -R $USERNAME:$USERNAME /bin/alloy \ | |
&& mkdir -p /var/lib/alloy/data \ | |
&& chown -R $USERNAME:$USERNAME /var/lib/alloy \ | |
&& chmod -R 770 /var/lib/alloy |
PR Description
Reduce the layers in the Docker image by 8 Layers. This also reduces the size of the Docker image
Which issue(s) this PR fixes
Notes to the Reviewer
PR Checklist