Add Dockerfile and requirements.txt#11
Conversation
harryhaaren
left a comment
There was a problem hiding this comment.
Hi All (Harry here - not the author of the project - but was using the script for grabbing stats (thanks to original author!) so figured I'd try contribute a bit.
PR here looks good, build the image and tested - works perfectly. docker build . results in a valid image, and docker run <image_id> gives the normal "usage" output as expected, same as the script gives "on baremetal". Adding valid switch IP and password, both work find.
One potential improvement is to use a minimalized base for the script? Today's image is ~1GB (!) which seems very large for a simple dockerized python3+script? Usually Alpine is a better/smaller image base, it seems the official Python image folks make an alpine version available too (link), which reduces the total image to ~60MB :)
python:3
<none> <none> 578cb428b665 7 minutes ago 1.03GB
python:alpine3.20
<none> <none> 4a5788ce332c 2 seconds ago 59.8MB
The following diff will change the Dockerfile to the new image:
diff --git a/Dockerfile b/Dockerfile
index 55f6ccf..0bd850e 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,4 +1,4 @@
-FROM python:3
+FROM python:alpine3.20
WORKDIR /essstat
There was a problem hiding this comment.
No changes to thei script, so no need to increment version
Added a Dockerfile as it's handy to have for environments that containerise everything.