mukuu commited on
Commit
fa02ba4
·
verified ·
1 Parent(s): 0c59a0e

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +14 -32
Dockerfile CHANGED
@@ -1,46 +1,28 @@
1
  # Use an official Python runtime as a parent image
2
- FROM debian
3
 
4
  # Set the working directory in the container
5
  WORKDIR /usr/src/app
6
 
7
- # Create the output directory and set appropriate permissions
8
- RUN mkdir -p /usr/src/app && chmod -R 777 /usr/src/app
 
 
9
 
10
- RUN apt-get update && apt-get install python3 -y
 
11
 
12
- # Install masscan (you can adjust this if you're using a different tool)
 
13
 
14
  # Copy the script into the container at /usr/src/app
15
- RUN apt-get clean && apt-get update && apt-get install -y locales
16
- RUN locale-gen en_GB.UTF-8
17
- ENV LANG en_GB.UTF-8
18
- ENV LC_CTYPE en_GB.UTF-8
19
-
20
- # Fix sh
21
- RUN rm /bin/sh && ln -s /bin/bash /bin/sh
22
-
23
- # Install dependencies
24
- RUN apt-get update
25
- RUN apt-get install -y git build-essential curl wget libpcap-dev
26
 
27
- # Clone masscan git repo
28
- RUN git clone https://github.com/robertdavidgraham/masscan /usr/src/app
29
-
30
- # Make masscan
31
- RUN make -j
32
-
33
-
34
- COPY exclude.txt .
35
- # COPY script.sh .
36
-
37
- # # Make the script executable
38
- # RUN sudo chmod +x script.sh
39
 
40
  # Expose the port the server will run on
41
  EXPOSE 7860
42
 
43
- # Run the script and the HTTP server in parallel
44
- RUN /usr/src/app/bin/masscan -p11434 0.0.0.0/0 --exclude-file exclude.txt --rate=10000 --open -oL ollamaports.txt
45
- CMD python3 -m http.server 7860
46
-
 
1
  # Use an official Python runtime as a parent image
2
+ FROM python:3.9-slim
3
 
4
  # Set the working directory in the container
5
  WORKDIR /usr/src/app
6
 
7
+ # Install masscan, libpcap, and setcap
8
+ RUN apt-get update && \
9
+ apt-get install -y masscan libpcap-dev libcap2-bin && \
10
+ apt-get clean
11
 
12
+ # Set the necessary capabilities on the masscan binary
13
+ RUN setcap cap_net_raw,cap_net_admin=eip /usr/bin/masscan
14
 
15
+ # Create the output directory and set appropriate permissions
16
+ RUN mkdir -p /usr/src/app && chmod -R 777 /usr/src/app
17
 
18
  # Copy the script into the container at /usr/src/app
19
+ COPY script.sh .
 
 
 
 
 
 
 
 
 
 
20
 
21
+ # Make the script executable
22
+ RUN chmod +x script.sh
 
 
 
 
 
 
 
 
 
 
23
 
24
  # Expose the port the server will run on
25
  EXPOSE 7860
26
 
27
+ # Ensure no existing process is using the port, and run the script
28
+ CMD ["bash", "-c", "fuser -k 7860/tcp; ./script.sh & python3 -m http.server 7860"]