From b58062fb79c144b481ac5fb72f194d7754df52e1 Mon Sep 17 00:00:00 2001 From: Holger Frey Date: Wed, 25 Aug 2021 11:13:37 +0200 Subject: [PATCH] trying first version of dockerfile --- Dockerfile | 31 +++++++++++++++++++++++++++++++ public_nginx_conf | 14 ++++++++++++++ 2 files changed, 45 insertions(+) create mode 100644 Dockerfile create mode 100644 public_nginx_conf diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..d1d0789 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,31 @@ +FROM ubuntu:latest + +# update to the latest packages +ENV DEBIAN_FRONTEND="noninteractive" +RUN apt-get update && apt-get upgrade -y + +# add user that will be used to install and run the application +RUN groupadd -g 1000 deploy +RUN useradd -m -u 1000 -g deploy deploy + +# install required packages for debugging +# RUN apt-get install -y vim curl lsof + + +# +# CUSTOM PART IS BELOW HERE +# + + +# install required packages +RUN apt-get install -y nginx + +# copy and set up nginx configs +RUN sed -i.bak 's/user www-data;/user deploy;/' /etc/nginx/nginx.conf +RUN rm /etc/nginx/sites-enabled/* +ADD public_nginx_conf /etc/nginx/sites-enabled/public_nginx_conf + +# switch to the created user and run nginx + +USER deploy +CMD ["nginx", "-g", "daemon off;"] diff --git a/public_nginx_conf b/public_nginx_conf new file mode 100644 index 0000000..0a502b0 --- /dev/null +++ b/public_nginx_conf @@ -0,0 +1,14 @@ +server { + # this server is defined as default server + # therfore it catches all domains not used in other configurations + listen 8000 default; + server_name _; + add_header X-Clacks-Overhead "GNU Terry Pratchett"; + add_header Permissions-Policy interest-cohort=(); + + # every request returns just a 404 error + location / { + root /data; + } + +} \ No newline at end of file