Skip to content

Refactor Dockerfile with multi-stage build and best practices #675

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

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

Conversation

hingston
Copy link

@hingston hingston commented Apr 26, 2025

Description

This PR refactors the Dockerfile to use a multi-stage build and implement best practices for image size reduction (of around 1GB) and security. It separates the build environment from the runtime environment and runs the application as a non-root user.

This change aims to produce a smaller, more secure, and efficient Docker image.

Fixes # (issue) - This is a refactor, not directly fixing a specific open issue unless one exists for Docker image size or security.

Type of change

Please delete options that are not relevant.

  • New feature (non-breaking change which adds functionality - adds multi-stage build capability)

How Has This Been Tested?

The refactored Dockerfile was built locally using docker build. The resulting image was then used to run the Twitch Channel Points Miner in a Docker container. This was tested extensively on a Raspberry Pi 4 Model B running Docker for a period of 3 days, operating without any issues related to the build or runtime environment.

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my code
  • I have commented on my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation (README.md
  • My changes generate no new warnings
  • Any dependent changes have been updated in requirements.txt

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.

1 participant