diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..716b537 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,15 @@ +FROM node:16-alpine AS builder + +WORKDIR /front + +COPY . . + +RUN npm install +RUN npm run build + +FROM nginx:1.21.6-alpine as runner + +COPY ./deploy/nginx.conf /etc/nginx/nginx.conf +COPY --from=builder /front/build /var/www/html + +EXPOSE 8080 \ No newline at end of file diff --git a/deploy/nginx.conf b/deploy/nginx.conf new file mode 100644 index 0000000..b3aba76 --- /dev/null +++ b/deploy/nginx.conf @@ -0,0 +1,33 @@ +worker_processes 1; +error_log /var/log/nginx/error.log warn; +pid /var/run/nginx.pid; +events { + worker_connections 1024; +} +http { + include mime.types; + default_type application/octet-stream; + log_format main '$remote_addr - $remote_user [$time_local] "$request" ' + '$status $body_bytes_sent "$http_referer" ' + '"$http_user_agent" "$http_x_forwarded_for"'; + access_log /var/log/nginx/access.log main; + sendfile on; + keepalive_timeout 65; + gzip_static on; + server { + listen 8080; + server_name localhost; + charset utf-8; + location / { + root /var/www/html; + try_files $uri /index.html; + etag on; + expires max; + add_header Cache-Control public; + location = /index.html { + expires 0; + add_header Cache-Control "no-cache, public, must-revalidate, proxy-revalidate"; + } + } + } +} \ No newline at end of file