diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..d005c6fa --- /dev/null +++ b/Dockerfile @@ -0,0 +1,20 @@ +FROM nginx:1.21.1 +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 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;' 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; + } + +