From bd278ead614196be04f34263f9d8868e97b18947 Mon Sep 17 00:00:00 2001 From: Rohan Rustagi <110477025+RohanRusta21@users.noreply.github.com> Date: Thu, 19 Oct 2023 16:07:40 +0000 Subject: [PATCH 1/2] "Added Dockerfile to dockerized the website" --- Dockerfile | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..7a52046 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,7 @@ +FROM ubuntu +RUN apt update -y +LABEL maintainer="Rohan Rustagi" +RUN apt install nginx -y +COPY . /var/www/html +EXPOSE 80 +CMD ["nginx", "-g", "daemon off;"] \ No newline at end of file From fa37df5d7793155766d4ebe685ce7f15a3b34d44 Mon Sep 17 00:00:00 2001 From: Rohan Rustagi <110477025+RohanRusta21@users.noreply.github.com> Date: Tue, 24 Oct 2023 17:20:59 +0000 Subject: [PATCH 2/2] "Modified Dockerfile as required" --- Dockerfile | 12 +++++------- README.md | 10 ++++++++++ nginx.conf | 10 ++++++++++ 3 files changed, 25 insertions(+), 7 deletions(-) create mode 100644 nginx.conf diff --git a/Dockerfile b/Dockerfile index 7a52046..27821f6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,5 @@ -FROM ubuntu -RUN apt update -y -LABEL maintainer="Rohan Rustagi" -RUN apt install nginx -y -COPY . /var/www/html -EXPOSE 80 -CMD ["nginx", "-g", "daemon off;"] \ No newline at end of file +FROM nginx:alpine +COPY . /usr/share/nginx/html +EXPOSE 80 443 +COPY nginx.conf /etc/nginx/conf.d/default.conf +CMD ["nginx", "-g", "daemon off;"] diff --git a/README.md b/README.md index b03cf22..68effff 100644 --- a/README.md +++ b/README.md @@ -73,3 +73,13 @@ The project structure is as follows: - [Sayed Afnan Khazi](https://github.com/Sayed-Afnan-Khazi) - [Aryan Thakur](https://github.com/Aryan-Kumar-Thakur) + +## Steps to use Docker + +```bash +docker build -t your-image-name:tag . +``` + +```bash +docker run -itd -p 80:80 -p 443:443 your-image-name:tag +``` diff --git a/nginx.conf b/nginx.conf new file mode 100644 index 0000000..69a204b --- /dev/null +++ b/nginx.conf @@ -0,0 +1,10 @@ +server { + listen 80; + listen 443; + server_name _; + + location / { + root /usr/share/nginx/html; + index index.html; + } +}