Update Dockerfile
Browse files- Dockerfile +9 -23
Dockerfile
CHANGED
|
@@ -1,30 +1,16 @@
|
|
| 1 |
-
# Use a minimal base image
|
| 2 |
-
FROM
|
| 3 |
-
|
| 4 |
-
# Install necessary tools. 'dmesg' is usually available, but 'grep' is essential.
|
| 5 |
-
# We also install 'util-linux' for 'dmesg' in case it's not in the base image,
|
| 6 |
-
# and 'coreutils' for general shell utilities.
|
| 7 |
-
RUN apk update && apk add --no-cache bash grep coreutils util-linux
|
| 8 |
|
| 9 |
# Set the working directory
|
| 10 |
WORKDIR /app
|
| 11 |
|
| 12 |
-
# Copy the
|
| 13 |
-
COPY detect_hypervisor.
|
| 14 |
-
|
| 15 |
-
# Make the script executable
|
| 16 |
-
RUN chmod +x detect_hypervisor.sh
|
| 17 |
|
| 18 |
# Command to run the script when the container starts
|
| 19 |
-
# The script
|
| 20 |
-
#
|
| 21 |
-
|
| 22 |
-
# rely on the host's environment when the container is run with the right flags.
|
| 23 |
-
# For the purpose of this Dockerfile, we just set the entrypoint.
|
| 24 |
-
ENTRYPOINT ["/app/detect_hypervisor.sh"]
|
| 25 |
|
| 26 |
-
# Note: The
|
| 27 |
-
#
|
| 28 |
-
# the container must be run with specific flags, typically:
|
| 29 |
-
# docker run --rm -v /sys:/sys:ro -v /dev/kmsg:/dev/kmsg:ro --privileged <image_name>
|
| 30 |
-
# I will include these instructions in the final delivery.
|
|
|
|
| 1 |
+
# Use a minimal Python base image
|
| 2 |
+
FROM python:3.11-slim
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
|
| 4 |
# Set the working directory
|
| 5 |
WORKDIR /app
|
| 6 |
|
| 7 |
+
# Copy the Python script into the container
|
| 8 |
+
COPY detect_hypervisor.py .
|
|
|
|
|
|
|
|
|
|
| 9 |
|
| 10 |
# Command to run the script when the container starts
|
| 11 |
+
# The script relies on reading system files, so the container will still need
|
| 12 |
+
# to be run with the necessary volume mounts.
|
| 13 |
+
ENTRYPOINT ["python", "detect_hypervisor.py"]
|
|
|
|
|
|
|
|
|
|
| 14 |
|
| 15 |
+
# Note: The instructions for running the container will be updated to reflect
|
| 16 |
+
# the need to mount the /sys filesystem for accurate detection.
|
|
|
|
|
|
|
|
|