ar08 commited on
Commit
d2e052d
·
verified ·
1 Parent(s): 646acdb

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +22 -16
Dockerfile CHANGED
@@ -1,9 +1,6 @@
1
  # Use Python 3.9 as base image
2
  FROM python:3.9
3
 
4
- # Switch to root user
5
- USER root
6
-
7
  # Set environment variables
8
  ENV PYTHONDONTWRITEBYTECODE 1
9
  ENV PYTHONUNBUFFERED 1
@@ -15,27 +12,36 @@ WORKDIR /app
15
 
16
  # Copy the local directory's contents into the container at /app
17
  COPY ./ /app/
18
- RUN chmod +x *
19
 
20
  # Install dependencies
21
  RUN apt-get update && \
22
  apt-get install -y qemu-kvm libvirt-daemon-system libvirt-clients bridge-utils virt-manager wget nano sudo && \
23
  pip install --no-cache-dir -r requirements.txt
24
 
25
- # Create a user with no password and grant sudo privileges
26
- RUN useradd -m -s /bin/bash user_name && \
27
- echo "user_name ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
28
 
29
- # Switch to the newly created user
30
- USER user_name
31
 
32
- # Create the VM image and download the Ubuntu ISO
33
- RUN qemu-img create -f qcow2 /app/ubuntu_vm.qcow2 15G
34
- RUN wget -O /app/ubuntu-20.04-live-server-amd64.iso https://old-releases.ubuntu.com/releases/20.04.2/ubuntu-20.04.2-live-server-amd64.iso
35
- RUN https://download.virtualbox.org/virtualbox/7.0.18/virtualbox-7.0_7.0.18-162988~Ubuntu~bionic_amd64.deb -o vm.deb
36
- RUN dpkg install vm.deb
37
- # Run the manage.sh script to install the VM
38
- RUN ./manage.sh install-vm
39
 
40
  # Run pyxtermjs when the container starts
41
  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
 
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 nano sudo && \
19
  pip install --no-cache-dir -r requirements.txt
20
 
21
+ # Download and install VirtualBox
22
+ RUN wget -O virtualbox.deb https://download.virtualbox.org/virtualbox/7.0.18/virtualbox-7.0_7.0.18-162988~Ubuntu~bionic_amd64.deb && \
23
+ dpkg -i virtualbox.deb && \
24
+ apt-get install -f -y && \
25
+ rm virtualbox.deb
26
+
27
+ # Create a new user without creating a group
28
+ RUN useradd -r -u 1000 -m -s /bin/bash appuser && \
29
+ chown -R appuser:appuser /app
30
+
31
+ # Grant execute permissions to all files in the /app directory
32
+ RUN chmod +x /app/*
33
+
34
+ # Switch to the new user
35
+ USER appuser
36
+
37
+
38
+
39
 
40
+ # Download the Ubuntu ISO
41
+ #RUN wget -O /app/ubuntu-20.04-live-server-amd64.iso https://old-releases.ubuntu.com/releases/20.04.2/ubuntu-20.04.2-live-server-amd64.iso
42
 
43
+ # Run the custom script to install the VM
44
+ #RUN ./manage.sh install-vm
 
 
 
 
 
45
 
46
  # Run pyxtermjs when the container starts
47
  CMD ["python", "-m", "pyxtermjs", "--host", "0.0.0.0", "-p", "7860"]