diff --git a/docs/Dockerfile b/docs/Dockerfile index 596b6365c..d6303fe24 100644 --- a/docs/Dockerfile +++ b/docs/Dockerfile @@ -14,6 +14,21 @@ COPY . . RUN npm run build #RUN node --max_old_space_size=8192 node_modules/@angular/cli/bin/ng build -- --deploy-url=/ --prod -EXPOSE 3000 -## Run the production server. -CMD ["npm", "run", "serve", "--", "--host", "0.0.0.0", "--no-open"] +FROM nginx:mainline-alpine + +#!/bin/sh + +COPY nginx.conf.CI /etc/nginx/conf.d/default.conf +COPY start_nginx.sh /start_nginx.sh +RUN mkdir -p /tmp/log/nginx + + +## Remove default nginx index page +RUN rm -rf /usr/share/nginx/html/* + +# Copy from the stage 1 +COPY --from=builder /src/build /usr/share/nginx/html +RUN cp /usr/share/nginx/html/index.html /usr/share/nginx/html/index_base.html + +EXPOSE 80 +ENTRYPOINT ["sh", "/start_nginx.sh"] diff --git a/docs/nginx.conf.CI b/docs/nginx.conf.CI new file mode 100644 index 000000000..505995564 --- /dev/null +++ b/docs/nginx.conf.CI @@ -0,0 +1,27 @@ +server { + + listen 80; + + sendfile on; + + default_type application/octet-stream; + + + gzip on; + gzip_http_version 1.1; + gzip_disable "MSIE [1-6]\."; + gzip_min_length 1100; + gzip_vary on; + gzip_proxied expired no-cache no-store private auth; + gzip_types text/plain text/css application/json application/javascript application/x-javascript text/xml application/xml application/xml+rss text/javascript; + gzip_comp_level 9; + + + root /usr/share/nginx/html; + + + location / { + try_files $uri $uri/ /index.html =404; + } + +} \ No newline at end of file diff --git a/docs/start_nginx.sh b/docs/start_nginx.sh new file mode 100644 index 000000000..463666f46 --- /dev/null +++ b/docs/start_nginx.sh @@ -0,0 +1,2 @@ +#!/bin/bash +nginx -g "daemon off;" \ No newline at end of file