diff --git a/Dockerfile b/Dockerfile index 12a84004d2543e6e7cc2d061a2bf21848f5430c7..2d79d85f7abb9b0cffb253f1e25dd46dddf81338 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,21 @@ +# Stage 0, based on Node.js, to build and compile Angular +FROM node:8.10.0 as builder + +# Copy the current directory contents into the container at /app +COPY ./webapp /app/webapp + +WORKDIR /app/webapp +# Install npm dependencies +RUN npm install +# Building the Angular app /dist i18n +RUN npm run build-i18n + +# Stage 1, based on Nginx, to have only the compiled app FROM nginx +COPY --from=builder /app/webapp/dist /usr/share/nginx/html + +## Install dependency to get lua module in .conf RUN apt-get update +RUN apt-get --yes --force-yes install nginx-extras -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 index 32a233f5e15d777721a901ee404279d78dd35ab4..0235e7f3f1190a7dd4b91a4ca6ff239e829773be 100644 --- a/docker-compose-staging.yml +++ b/docker-compose-staging.yml @@ -1,10 +1,6 @@ version: "2" services: - - node-server: - build: ./webapp - proxy-elasticsearch: image: nginx volumes: @@ -17,7 +13,6 @@ services: context: ./ volumes: - ./webapp-nginx.conf:/etc/nginx/conf.d/default.conf - - ./webapp/dist:/usr/share/nginx/html ports: - 8080:8080 diff --git a/webapp-nginx.conf b/webapp-nginx.conf index dd41d66b18263d14353a69590e82bdd78124500b..49e82096e4161e7c86c0ed08747165c751e1417d 100644 --- a/webapp-nginx.conf +++ b/webapp-nginx.conf @@ -14,7 +14,6 @@ for lang in (ngx.var.http_accept_language .. ","):gmatch("([^,]*),") do ngx.redirect("/fr/") end end -ngx.redirect("/en/") '; #rewrite ^/$ /en/ permanent; diff --git a/webapp/Dockerfile b/webapp/Dockerfile deleted file mode 100644 index c381c792a7b2dc8aadeaf6c0e75852a5c33ba858..0000000000000000000000000000000000000000 --- a/webapp/Dockerfile +++ /dev/null @@ -1,22 +0,0 @@ -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