File size: 1,474 Bytes
b9cfc73
0108aed
 
b9cfc73
0108aed
 
 
 
 
a780c4d
 
0108aed
 
b9cfc73
0108aed
 
b9cfc73
0108aed
 
b9cfc73
 
05d447e
 
b9cfc73
88aa461
016f93e
b9cfc73
 
 
 
 
 
 
 
 
 
 
 
 
a780c4d
 
 
b9cfc73
a780c4d
b9cfc73
 
a780c4d
 
 
b9cfc73
0108aed
 
b9cfc73
0108aed
 
b9cfc73
 
 
 
0108aed
 
b9cfc73
a780c4d
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# Use an official Golang runtime as a parent image
FROM golang:1.21

# Install necessary dependencies
RUN apt-get update && apt-get install -y \
    wget \
    git \
    curl \
    zip \
    python3 \
    python3-venv \
    && rm -rf /var/lib/apt/lists/*

# Install Katana
RUN go install github.com/projectdiscovery/katana/cmd/katana@latest

# Set the GOPATH and add Katana to PATH
ENV GOPATH=/go
ENV PATH=$GOPATH/bin:/usr/local/go/bin:$PATH

# Set MPLCONFIGDIR to a writable directory
ENV MPLCONFIGDIR=/tmp/.matplotlib

# Create a writable directory for Katana's config
RUN mkdir -p /tmp/katana

# Set the environment variable for Katana's config directory
ENV KATANA_CONFIG=/tmp/katana

# Create a non-root user
RUN useradd -m myuser

# Change ownership of the /tmp/katana directory to myuser
RUN chown -R myuser:myuser /tmp/katana

# Set appropriate permissions
RUN chmod 755 /tmp/katana

# Create and activate a virtual environment for Python
RUN python3 -m venv /app/venv
ENV PATH="/app/venv/bin:$PATH"

# Copy requirements file
COPY requirements.txt /app/requirements.txt

# Install Python dependencies in the virtual environment
RUN pip install --upgrade pip \
    && pip install -r /app/requirements.txt

# Copy the Gradio app code to the container
COPY app.py /app/app.py

# Set the working directory
WORKDIR /app

# Switch to the non-root user
USER myuser

# Expose the port Gradio will run on
EXPOSE 7860

# Command to run the Gradio app
CMD ["python", "app.py"]