From e2d8ac4bfdc1e96cf87a5ff95968a5e4acc9a2a8 Mon Sep 17 00:00:00 2001 From: YaakoubiNejib <94083012+YaakoubiNejib@users.noreply.github.com> Date: Sat, 3 Feb 2024 12:41:38 +0100 Subject: [PATCH 1/4] Create Dockerfile --- Dockerfile | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..cd0c5057 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,9 @@ +FROM nginx:1.21.1 +LABEL maintainer Nejib yaakoubi +RUN apt-get update &&\ + apt-get upgrade -y&&\ + apt-get install -y curl &&\ + apt-get install -y git +RUN rm -Rf /usr/share/nginx/html/* +RUN git clone + From 9b40a4e9164239732d537617bbe0330018cd58d7 Mon Sep 17 00:00:00 2001 From: YaakoubiNejib <94083012+YaakoubiNejib@users.noreply.github.com> Date: Sat, 3 Feb 2024 12:46:00 +0100 Subject: [PATCH 2/4] Update Dockerfile --- Dockerfile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index cd0c5057..6eacecaa 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,5 +5,7 @@ RUN apt-get update &&\ apt-get install -y curl &&\ apt-get install -y git RUN rm -Rf /usr/share/nginx/html/* -RUN git clone +RUN git clone https://github.com/YaakoubiNejib/static-website-example.git +COPY nginx.conf /etc/nginx/conf.d/default.conf +CMD sed -i -e 's/$PORT/'"$PORT"'/g' /etc/nginx/conf.d/default.conf && nginx -g 'daemon off;' From 3b3cf5f569e60accc7b594beaca8e9f0c3c389c6 Mon Sep 17 00:00:00 2001 From: YaakoubiNejib <94083012+YaakoubiNejib@users.noreply.github.com> Date: Sat, 3 Feb 2024 12:47:10 +0100 Subject: [PATCH 3/4] Update Dockerfile --- Dockerfile | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/Dockerfile b/Dockerfile index 6eacecaa..d005c6fa 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,11 +1,20 @@ FROM nginx:1.21.1 -LABEL maintainer Nejib yaakoubi -RUN apt-get update &&\ - apt-get upgrade -y&&\ - apt-get install -y curl &&\ - apt-get install -y git -RUN rm -Rf /usr/share/nginx/html/* -RUN git clone https://github.com/YaakoubiNejib/static-website-example.git +LABEL maintainer="Nejib yaakoubi" + +# Install required packages +RUN apt-get update && \ + apt-get upgrade -y && \ + apt-get install -y curl git && \ + rm -rf /var/lib/apt/lists/* + +# Remove default NGINX website content +RUN rm -rf /usr/share/nginx/html/* + +# Clone your static website repository +RUN git clone https://github.com/YaakoubiNejib/static-website-example.git /usr/share/nginx/html + +# Copy custom nginx configuration COPY nginx.conf /etc/nginx/conf.d/default.conf -CMD sed -i -e 's/$PORT/'"$PORT"'/g' /etc/nginx/conf.d/default.conf && nginx -g 'daemon off;' - + +# CMD to replace $PORT with the actual port and start NGINX +CMD sed -i -e 's/$PORT/'"$PORT"'/g' /etc/nginx/conf.d/default.conf && nginx -g 'daemon off;' From 841c74b4f472c0c42607d2631d62c6b5da1019f2 Mon Sep 17 00:00:00 2001 From: YaakoubiNejib <94083012+YaakoubiNejib@users.noreply.github.com> Date: Sat, 3 Feb 2024 12:49:27 +0100 Subject: [PATCH 4/4] Create nginx.conf --- nginx.conf | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 nginx.conf diff --git a/nginx.conf b/nginx.conf new file mode 100644 index 00000000..2121bf73 --- /dev/null +++ b/nginx.conf @@ -0,0 +1,9 @@ +server { + listen 0.0.0.0:$PORT; + + location / { + root /usr/share/nginx/html; + index index.html; + } + +