Spaces:
Runtime error
Runtime error
Update Dockerfile
Browse files- Dockerfile +14 -32
Dockerfile
CHANGED
|
@@ -1,46 +1,28 @@
|
|
| 1 |
# Use an official Python runtime as a parent image
|
| 2 |
-
FROM
|
| 3 |
|
| 4 |
# Set the working directory in the container
|
| 5 |
WORKDIR /usr/src/app
|
| 6 |
|
| 7 |
-
#
|
| 8 |
-
RUN
|
|
|
|
|
|
|
| 9 |
|
| 10 |
-
|
|
|
|
| 11 |
|
| 12 |
-
#
|
|
|
|
| 13 |
|
| 14 |
# Copy the script into the container at /usr/src/app
|
| 15 |
-
|
| 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 |
-
#
|
| 28 |
-
RUN
|
| 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 |
-
#
|
| 44 |
-
|
| 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"]
|
|
|
|
|
|