ar08 commited on
Commit
f27baa2
·
verified ·
1 Parent(s): 62af5f0

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +18 -3
Dockerfile CHANGED
@@ -1,6 +1,5 @@
1
  # Use Python 3.9 as base image
2
  FROM python:3.9
3
- User root
4
 
5
  # Set environment variables
6
  ENV PYTHONDONTWRITEBYTECODE 1
@@ -13,14 +12,30 @@ WORKDIR /app
13
 
14
  # Copy the local directory's contents into the container at /app
15
  COPY ./ /app/
16
- RUN chmod +x *
17
  # Install dependencies
18
  RUN apt-get update && \
19
  apt-get install -y qemu-kvm libvirt-daemon-system libvirt-clients bridge-utils virt-manager wget nano && \
20
  pip install --no-cache-dir -r requirements.txt
21
 
 
 
 
 
 
 
 
 
 
 
 
 
22
  RUN qemu-img create -f qcow2 /app/ubuntu_vm.qcow2 15G
23
- 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
 
 
 
 
24
  RUN ./manage.sh install-vm
25
 
26
  # Run pyxtermjs when the container starts
 
1
  # Use Python 3.9 as base image
2
  FROM python:3.9
 
3
 
4
  # Set environment variables
5
  ENV PYTHONDONTWRITEBYTECODE 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 && \
19
  pip install --no-cache-dir -r requirements.txt
20
 
21
+ # Create a new user and group
22
+ RUN groupadd -g 1000 appuser && \
23
+ useradd -r -u 1000 -g appuser appuser && \
24
+ chown -R appuser:appuser /app
25
+
26
+ # Grant execute permissions to all files in the /app directory
27
+ RUN chmod +x /app/*
28
+
29
+ # Switch to the new user
30
+ USER appuser
31
+
32
+ # Create a new qcow2 image
33
  RUN qemu-img create -f qcow2 /app/ubuntu_vm.qcow2 15G
34
+
35
+ # Download the Ubuntu ISO
36
+ #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
37
+
38
+ # Run the custom script to install the VM
39
  RUN ./manage.sh install-vm
40
 
41
  # Run pyxtermjs when the container starts