ar08 commited on
Commit
209c52f
·
verified ·
1 Parent(s): e620b5c

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +27 -14
Dockerfile CHANGED
@@ -1,32 +1,45 @@
1
  # Use Python 3.9 as base image
2
  FROM python:3.9
3
- User root
4
  # Set environment variables
5
  ENV PYTHONDONTWRITEBYTECODE 1
6
  ENV PYTHONUNBUFFERED 1
7
  ENV DEBIAN_FRONTEND=noninteractive
 
 
8
  # Set working directory
9
  WORKDIR /app
10
 
11
-
12
  # Copy the local directory's contents into the container at /app
13
  COPY ./ /app/
14
 
15
  # Install dependencies
16
- RUN pip install --no-cache-dir -r requirements.txt
17
- RUN apt-get update \
18
- && apt-get install -y git \
19
- && git clone https://github.com/termux/proot-distro \
20
- && cd proot-distro \
21
- && ./install.sh \
22
- && cd .. \
23
- && rm -rf proot-distro \
24
- && apt-get purge -y git \
25
- && apt-get autoremove -y
 
 
 
 
 
 
 
 
 
 
 
 
 
 
26
  # Expose the default port used by pyxtermjs
27
  EXPOSE 8080
28
- ENV TERM=xterm-256color
29
-
30
 
31
  # Run pyxtermjs when the container starts
32
  CMD ["python", "-m", "pyxtermjs", "--host", "0.0.0.0", "-p", "7860"]
 
1
  # Use Python 3.9 as base image
2
  FROM python:3.9
3
+
4
  # Set environment variables
5
  ENV PYTHONDONTWRITEBYTECODE 1
6
  ENV PYTHONUNBUFFERED 1
7
  ENV DEBIAN_FRONTEND=noninteractive
8
+ ENV TERM=xterm-256color
9
+
10
  # Set working directory
11
  WORKDIR /app
12
 
 
13
  # Copy the local directory's contents into the container at /app
14
  COPY ./ /app/
15
 
16
  # Install dependencies
17
+ RUN apt-get update && \
18
+ apt-get install -y qemu-kvm libvirt-daemon-system libvirt-clients bridge-utils virt-manager wget && \
19
+ pip install --no-cache-dir -r requirements.txt
20
+
21
+ # Create virtual disk image
22
+ RUN qemu-img create -f qcow2 /app/ubuntu_vm.qcow2 20G
23
+
24
+ # Download Ubuntu ISO
25
+ RUN wget -O /app/ubuntu-20.04-live-server-amd64.iso https://releases.ubuntu.com/20.04/ubuntu-20.04-live-server-amd64.iso
26
+
27
+ # Install Ubuntu on the VM
28
+ RUN virt-install \
29
+ --name ubuntu_vm \
30
+ --ram 15360 \
31
+ --disk path=/app/ubuntu_vm.qcow2,format=qcow2 \
32
+ --vcpus 2 \
33
+ --os-type linux \
34
+ --os-variant ubuntu20.04 \
35
+ --network bridge=virbr0,model=virtio \
36
+ --graphics none \
37
+ --console pty,target_type=serial \
38
+ --location 'http://archive.ubuntu.com/ubuntu/dists/focal/main/installer-amd64/' \
39
+ --extra-args 'console=ttyS0,115200n8 serial' || true
40
+
41
  # Expose the default port used by pyxtermjs
42
  EXPOSE 8080
 
 
43
 
44
  # Run pyxtermjs when the container starts
45
  CMD ["python", "-m", "pyxtermjs", "--host", "0.0.0.0", "-p", "7860"]