# Use a lightweight Python base image FROM python:3.9-slim-buster # Set the working directory inside the container WORKDIR /app # Copy the HTML file into the container COPY real_webvm.html . # Create the Python server script directly in the Dockerfile # This ensures it has the correct permissions from the start RUN echo "import http.server" > server.py && \ echo "import socketserver" >> server.py && \ echo "" >> server.py && \ echo "PORT = 8000" >> server.py && \ echo "" >> server.py && \ echo "class Handler(http.server.SimpleHTTPRequestHandler):" >> server.py && \ echo " def end_headers(self):" >> server.py && \ echo " self.send_header('Cross-Origin-Embedder-Policy', 'require-corp')" >> server.py && \ echo " self.send_header('Cross-Origin-Opener-Policy', 'same-origin')" >> server.py && \ echo " super().end_headers()" >> server.py && \ echo "" >> server.py && \ echo "with socketserver.TCPServer(('', PORT), Handler) as httpd:" >> server.py && \ echo " print(f\"Serving real_webvm.html at http://localhost:{PORT}\")" >> server.py && \ echo " httpd.serve_forever()" >> server.py # Copy the run.sh script into the container COPY run.sh . # Make the run.sh script executable RUN chmod +x run.sh # Expose the port that the server will listen on EXPOSE 8000 # Define the command to run when the container starts CMD ["./run.sh"]