From fee7a4f6da18e8ec165411a18b4a955d5dabb359 Mon Sep 17 00:00:00 2001 From: Roman Timashev Date: Sat, 3 Aug 2019 19:03:39 +0300 Subject: [PATCH] nginx + dockerfile update --- Dockerfile | 63 ++++++++++++++++++++++++++++++++++++------------------ nginx.conf | 56 +++++++++++------------------------------------- 2 files changed, 54 insertions(+), 65 deletions(-) diff --git a/Dockerfile b/Dockerfile index 1a7044af..012b7a9c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,27 +1,48 @@ -# Build -FROM node:10 as build -WORKDIR /app +# # Build +# FROM node:10 as build +# WORKDIR /app -COPY package.json package-lock.json ./ -RUN npm i -COPY webpack.config.js gulpfile.js .babelrc ./ -COPY robots.txt ./ -COPY src ./src -RUN npm run gulp -RUN npm run build-app -RUN npm run out +# COPY package.json package-lock.json ./ +# RUN npm i +# COPY webpack.config.js gulpfile.js .babelrc ./ +# COPY robots.txt ./ +# COPY src ./src +# RUN npm run gulp +# RUN npm run build-app +# RUN npm run out + + +# # Run +# FROM node:8-alpine +# WORKDIR /app + +# COPY package.json package-lock.json ./ +# RUN npm i --production + +# COPY --from=build /app/out ./src +# COPY --from=build /app/public ./public + +# EXPOSE 3000 + +# CMD npm start + + +# FROM node:12-alpine as build +# WORKDIR /app + +# COPY package.json package-lock.json ./ +# RUN npm ci + +# COPY . . +# RUN npm run build +# RUN npm run start & npm run export # Run -FROM node:8-alpine -WORKDIR /app +FROM nginx:stable-alpine -COPY package.json package-lock.json ./ -RUN npm i --production +COPY nginx.conf /etc/nginx/conf.d/default.conf -COPY --from=build /app/out ./src -COPY --from=build /app/public ./public - -EXPOSE 3000 - -CMD npm start \ No newline at end of file +WORKDIR /usr/share/nginx/html +# COPY --from=build /app/dist /usr/share/nginx/html +COPY ./dist /usr/share/nginx/html \ No newline at end of file diff --git a/nginx.conf b/nginx.conf index abc7de45..8bb4e920 100644 --- a/nginx.conf +++ b/nginx.conf @@ -1,48 +1,16 @@ server { - listen 443 ssl; - charset utf-8; - - server_name art.shlisselburg.org; - - ssl_certificate /etc/letsencrypt/live/art.shlisselburg.org/fullchain.pem; - ssl_certificate_key /etc/letsencrypt/live/art.shlisselburg.org/privkey.pem; - - ssl_protocols TLSv1 TLSv1.1 TLSv1.2; - ssl_prefer_server_ciphers on; - ssl_ciphers AES256+EECDH:AES256+EDH:!aNULL; - - location / { - proxy_pass http://hudozka; - proxy_http_version 1.1; - proxy_set_header Upgrade $http_upgrade; - proxy_set_header Connection $connection_upgrade; - - proxy_set_header Host $host; - proxy_set_header X-Forwarded-For $remote_addr; - } - - error_log /var/log/nginx/art.shburg.error.log; - access_log /var/log/nginx/art.shburg.access.log; -} - -server { - listen 80; - server_name art.shlisselburg.org art.shburg.org; - - location ^~ /.well-known/acme-challenge { - root /home/hoster/www/art.shburg.org/public; - } - + listen 80; + server_name localhost; + charset utf-8; location / { - return 301 https://art.shlisselburg.org$request_uri; + root /usr/share/nginx/html; + index index.html index.htm; + try_files $uri $uri.html $uri/index.html =404; } -} - -map $http_upgrade $connection_upgrade { - default upgrade; - '' close; -} - -upstream hudozka { - server localhost:1800; + location = /50x.html { + root /usr/share/nginx/html; + } +# redirect server error pages to the static page /50x.html +# + error_page 500 502 503 504 /50x.html; }