diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..12a84004d2543e6e7cc2d061a2bf21848f5430c7 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,5 @@ +FROM nginx + +RUN apt-get update + +RUN apt-get --yes --force-yes install nginx-extras \ No newline at end of file diff --git a/docker-compose-staging.yml b/docker-compose-staging.yml new file mode 100644 index 0000000000000000000000000000000000000000..32a233f5e15d777721a901ee404279d78dd35ab4 --- /dev/null +++ b/docker-compose-staging.yml @@ -0,0 +1,24 @@ +version: "2" + +services: + + node-server: + build: ./webapp + + proxy-elasticsearch: + image: nginx + volumes: + - ./proxy.conf:/etc/nginx/conf.d/default.conf + ports: + - 8000:80 + + nginx-app: + build: + context: ./ + volumes: + - ./webapp-nginx.conf:/etc/nginx/conf.d/default.conf + - ./webapp/dist:/usr/share/nginx/html + ports: + - 8080:8080 + + \ No newline at end of file diff --git a/proxy.conf b/proxy.conf new file mode 100644 index 0000000000000000000000000000000000000000..aeb138e09c8db62de609d4e92a45376bb41a1060 --- /dev/null +++ b/proxy.conf @@ -0,0 +1,15 @@ +server { + listen 80; + server_name _; + + location / { + proxy_pass https://elastic2.recette.data.grandlyon.com/elastic/; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header Host $http_host; + add_header 'Access-Control-Allow-Origin' '*'; + add_header 'Access-Control-Allow-Credentials' 'true'; + add_header 'Access-Control-Allow-Methods' 'GET, OPTIONS'; + add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type'; + } +} \ No newline at end of file diff --git a/webapp-nginx.conf b/webapp-nginx.conf new file mode 100644 index 0000000000000000000000000000000000000000..dd41d66b18263d14353a69590e82bdd78124500b --- /dev/null +++ b/webapp-nginx.conf @@ -0,0 +1,31 @@ + +server { + listen 8080; + server_name portail-data; + root /usr/share/nginx/html; + +location = / { +rewrite_by_lua ' +for lang in (ngx.var.http_accept_language .. ","):gmatch("([^,]*),") do + if string.sub(lang, 0, 2) == "en" then + ngx.redirect("/en/") + end + if string.sub(lang, 0, 2) == "fr" then + ngx.redirect("/fr/") + end +end +ngx.redirect("/en/") +'; +#rewrite ^/$ /en/ permanent; + +# First attempt to serve request as file, then +# as directory, then fall back to displaying a 404. +# Uncomment to enable naxsi on this location +# include /etc/nginx/naxsi.rules +} + error_page 404 = @notfound; + + location @notfound { + return 301 /; + } +} \ No newline at end of file diff --git a/webapp/.dockerignore b/webapp/.dockerignore new file mode 100644 index 0000000000000000000000000000000000000000..27c38f71a6487df53e781a8ed7bf9eae37e2145f --- /dev/null +++ b/webapp/.dockerignore @@ -0,0 +1,2 @@ +**/.git +**/node_modules diff --git a/webapp/Dockerfile b/webapp/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..c381c792a7b2dc8aadeaf6c0e75852a5c33ba858 --- /dev/null +++ b/webapp/Dockerfile @@ -0,0 +1,22 @@ +FROM node:8.10.0 + + +# Copy the current directory contents into the container at /app +COPY . /app/webapp +#COPY ../node-server /app/node-server + +WORKDIR /app/webapp +# Install npm dependencies +RUN npm install +# Building the Angular app /dist i18n +RUN npm run win-build-i18n:fr +#RUN cp -r ./dist ../node-server/dist + +# Set the working directory to /node-server +#WORKDIR /app/node-server +# Install npm dependencies +#RUN npm install + +#EXPOSE 8080 + +#CMD npm start