binuser007 commited on
Commit
b9cfc73
·
verified ·
1 Parent(s): 88aa461

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +30 -2
Dockerfile CHANGED
@@ -1,5 +1,7 @@
 
1
  FROM golang:1.21
2
 
 
3
  RUN apt-get update && apt-get install -y \
4
  wget \
5
  git \
@@ -7,29 +9,55 @@ RUN apt-get update && apt-get install -y \
7
  zip \
8
  python3 \
9
  python3-venv \
10
- libglib2.0-0 \
11
  && rm -rf /var/lib/apt/lists/*
12
 
 
13
  RUN go install github.com/projectdiscovery/katana/cmd/katana@latest
14
 
 
15
  ENV GOPATH=/go
16
  ENV PATH=$GOPATH/bin:/usr/local/go/bin:$PATH
 
 
17
  ENV MPLCONFIGDIR=/tmp/.matplotlib
18
- ENV KATANA_CONFIG=/tmp/katana
19
 
 
20
  RUN mkdir -p /tmp/katana
21
 
 
 
 
 
 
 
 
 
 
 
 
 
 
22
  RUN python3 -m venv /app/venv
23
  ENV PATH="/app/venv/bin:$PATH"
24
 
 
25
  COPY requirements.txt /app/requirements.txt
 
 
26
  RUN pip install --upgrade pip \
27
  && pip install -r /app/requirements.txt
28
 
 
29
  COPY app.py /app/app.py
30
 
 
31
  WORKDIR /app
32
 
 
 
 
 
33
  EXPOSE 7860
34
 
 
35
  CMD ["python", "app.py"]
 
1
+ # Use an official Golang runtime as a parent image
2
  FROM golang:1.21
3
 
4
+ # Install necessary dependencies
5
  RUN apt-get update && apt-get install -y \
6
  wget \
7
  git \
 
9
  zip \
10
  python3 \
11
  python3-venv \
 
12
  && rm -rf /var/lib/apt/lists/*
13
 
14
+ # Install Katana
15
  RUN go install github.com/projectdiscovery/katana/cmd/katana@latest
16
 
17
+ # Set the GOPATH and add Katana to PATH
18
  ENV GOPATH=/go
19
  ENV PATH=$GOPATH/bin:/usr/local/go/bin:$PATH
20
+
21
+ # Set MPLCONFIGDIR to a writable directory
22
  ENV MPLCONFIGDIR=/tmp/.matplotlib
 
23
 
24
+ # Create a writable directory for Katana's config
25
  RUN mkdir -p /tmp/katana
26
 
27
+ # Set the environment variable for Katana's config directory
28
+ ENV KATANA_CONFIG=/tmp/katana
29
+
30
+ # Create a non-root user
31
+ RUN useradd -m myuser
32
+
33
+ # Change ownership of the /tmp/katana directory to myuser
34
+ RUN chown -R myuser:myuser /tmp/katana
35
+
36
+ # Set appropriate permissions
37
+ RUN chmod 755 /tmp/katana
38
+
39
+ # Create and activate a virtual environment for Python
40
  RUN python3 -m venv /app/venv
41
  ENV PATH="/app/venv/bin:$PATH"
42
 
43
+ # Copy requirements file
44
  COPY requirements.txt /app/requirements.txt
45
+
46
+ # Install Python dependencies in the virtual environment
47
  RUN pip install --upgrade pip \
48
  && pip install -r /app/requirements.txt
49
 
50
+ # Copy the Gradio app code to the container
51
  COPY app.py /app/app.py
52
 
53
+ # Set the working directory
54
  WORKDIR /app
55
 
56
+ # Switch to the non-root user
57
+ USER myuser
58
+
59
+ # Expose the port Gradio will run on
60
  EXPOSE 7860
61
 
62
+ # Command to run the Gradio app
63
  CMD ["python", "app.py"]