forked from lindsey98/Phishpedia
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdockerfile
36 lines (36 loc) · 1.74 KB
/
dockerfile
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
# Use Ubuntu 20.04 as the base image
FROM ubuntu:20.04
# Prevent interactive prompts during installation
ARG DEBIAN_FRONTEND=noninteractive
# Install Miniconda
RUN apt-get update && apt-get install -y wget && \
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh && \
bash Miniconda3-latest-Linux-x86_64.sh -b -p /opt/miniconda && \
rm Miniconda3-latest-Linux-x86_64.sh
# Add Miniconda to PATH
ENV PATH="/opt/miniconda/bin:${PATH}"
# Set working directory
WORKDIR /workspace
# Install git, unzip and other dependencies
RUN apt-get install -y git unzip libgl1-mesa-glx libglib2.0-0
# Clone the Phishpedia project from GitHub into the container
RUN git clone https://github.com/lindsey98/Phishpedia.git /workspace/Phishpedia
# Change to the project directory and run setup.sh to configure the environment
WORKDIR /workspace/Phishpedia
# Install dos2unix
RUN apt-get install -y dos2unix
# Convert setup.sh to Unix format and RUN it
RUN dos2unix setup.sh
RUN chmod +x setup.sh
RUN bash setup.sh || true
# Install Flask and Flask-CORS
RUN /opt/miniconda/envs/phishpedia/bin/pip install "werkzeug>=2.3.7" "flask>=2.3.3" "flask-cors>=4.0.0"
# Ensure Conda is initialized and phishpedia environment is activated by default
RUN echo "source /opt/miniconda/etc/profile.d/conda.sh && conda activate phishpedia" >> ~/.bashrc
# Set the default command to execute when the container starts
CMD ["bash", "-c", "source /opt/miniconda/etc/profile.d/conda.sh && conda activate phishpedia && cd /workspace/Phishpedia && python app.py"]
# Expose the port that the application may use (assuming app.py uses port 5000)
EXPOSE 5000
# Add health check
HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 \
CMD curl -f http://localhost:5000/ || exit 1