Skip to content
This repository was archived by the owner on Sep 2, 2022. It is now read-only.

feat: reduce image size by 100MB using multi-stage dockerbuild, introduce using a user#74

Open
jlongman wants to merge 1 commit into
titilambert:masterfrom
jlongman:dockercleanup
Open

feat: reduce image size by 100MB using multi-stage dockerbuild, introduce using a user#74
jlongman wants to merge 1 commit into
titilambert:masterfrom
jlongman:dockercleanup

Conversation

@jlongman

@jlongman jlongman commented Oct 24, 2021

Copy link
Copy Markdown

Introduce a multi-stage build - reduces size from ~160MB by ~100MB down to 60MB.

  • use the --user installation which puts the installation into $HOME/.local.
  • change the entrypoint to reference as so

Use a user in the final container - best practices, security.

  • move from /root/.local to /home/appuser/.local

note, I've only tested docker run --rm -it -ePYHQ_USER -ePYHQ_PASSWORD from the cli as I don't have a mqtt setup atm.

@jlongman jlongman changed the title feat: multi-stage dockerbuild, use a user feat: reduce image size by 100MB using multi-stage dockerbuild, introduce using a user Oct 24, 2021
Comment thread entrypoint.sh
export CONFIG="/etc/pyhydroquebec/pyhydroquebec.yaml"
fi

if [ "$PYHQ_OUTPUT" == "MQTT" ]

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Why remove an = in the condition?

@jlongman jlongman Oct 28, 2021

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

definitely didn't know this previously but for the bourne shell, sh:

== operator is not supported in POSIX sh

https://github.com/koalaman/shellcheck/wiki/SC2039#testing-equality

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.

2 participants