Fred808 commited on
Commit
f6a2cdd
·
verified ·
1 Parent(s): 2f582aa

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +9 -23
Dockerfile CHANGED
@@ -1,30 +1,16 @@
1
- # Use a minimal base image for a small footprint
2
- FROM alpine:latest
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 detection script into the container
13
- COPY detect_hypervisor.sh .
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 needs to be run with the necessary privileges to access /sys and dmesg.
20
- # When running the container, the user will need to use '--privileged' or
21
- # map the necessary devices/directories, but for a simple check, we'll
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 script relies on reading system files like /sys/hypervisor/microsoft
27
- # and the output of 'dmesg'. To make this work inside a Docker container,
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.