From 91b07d7cdeeb30dcb8357bf9be48c85797c80657 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lu=C3=ADs=20Freitas?= Date: Tue, 5 Nov 2024 16:22:11 +0000 Subject: [PATCH] Add Dockerfile to deploy the app Add a Dockerfile to build and deploy the Flask application. * **Dockerfile** - Use the official Python 3 image as the base image. - Set the working directory to `/app`. - Copy the `requirements.txt` file to the working directory. - Install the dependencies using `pip install -r requirements.txt`. - Copy the rest of the application files to the working directory. - Set the entry point to run `vulnerable-flask-app-linux.py`. - Expose port 8081. * **README.md** - Add instructions on how to build and run the Docker container. --- For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/videvelopers/Vulnerable-Flask-App?shareId=XXXX-XXXX-XXXX-XXXX). --- Dockerfile | 20 ++++++++++++++++++++ README.md | 13 +++++++++++-- 2 files changed, 31 insertions(+), 2 deletions(-) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..04dfa73 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,20 @@ +# Use the official Python 3 image as the base image +FROM python:3 + +# Set the working directory to /app +WORKDIR /app + +# Copy the requirements.txt file to the working directory +COPY requirements.txt . + +# Install the dependencies using pip install -r requirements.txt +RUN pip install -r requirements.txt + +# Copy the rest of the application files to the working directory +COPY . . + +# Set the entry point to run vulnerable-flask-app-linux.py +ENTRYPOINT ["python", "vulnerable-flask-app-linux.py"] + +# Expose port 8081 +EXPOSE 8081 diff --git a/README.md b/README.md index 2581483..048e84a 100644 --- a/README.md +++ b/README.md @@ -54,6 +54,17 @@ git clone https://github.com/videvelopers/Vulnerable-Flask-App.git cd Vulnerable-Flask-App 3. Run the Flask application. +### Docker + +1. Clone this repository to your local machine. +git clone https://github.com/videvelopers/Vulnerable-Flask-App.git +2. Navigate to the cloned directory. +cd Vulnerable-Flask-App +3. Build the Docker image. +docker build -t vulnerable-flask-app . +4. Run the Docker container. +docker run -p 8081:8081 vulnerable-flask-app + # Disclaimer **This application is for educational purposes only. Use it at your own risk. The author is not responsible for any damage caused by this application. Do not run this application on a production server.** @@ -65,5 +76,3 @@ cd Vulnerable-Flask-App [ salman@videvelopers.com](salman@videvelopers.com) [blog](st-tlc.blogspot.com) - -