fix dockerfile
This commit is contained in:
14
Dockerfile
14
Dockerfile
@@ -1,9 +1,17 @@
|
|||||||
FROM nginx:latest
|
# Use the official Nginx image as the base
|
||||||
|
FROM nginx:alpine
|
||||||
|
|
||||||
WORKDIR /app
|
# Remove default nginx website
|
||||||
|
RUN rm -rf /usr/share/nginx/html/*
|
||||||
|
|
||||||
COPY ./build/* /usr/share/nginx/html/
|
# Copy build output from dist folder to nginx html directory
|
||||||
|
COPY dist/ /usr/share/nginx/html/
|
||||||
|
|
||||||
|
# Copy custom nginx config
|
||||||
COPY nginx.conf /etc/nginx/nginx.conf
|
COPY nginx.conf /etc/nginx/nginx.conf
|
||||||
|
|
||||||
|
# Expose port 80
|
||||||
EXPOSE 80
|
EXPOSE 80
|
||||||
|
|
||||||
|
# Start nginx
|
||||||
CMD ["nginx", "-g", "daemon off;"]
|
CMD ["nginx", "-g", "daemon off;"]
|
||||||
|
|||||||
40
nginx.conf
40
nginx.conf
@@ -1,29 +1,27 @@
|
|||||||
|
worker_processes 1;
|
||||||
|
|
||||||
|
events { worker_connections 1024; }
|
||||||
|
|
||||||
http {
|
http {
|
||||||
|
include mime.types;
|
||||||
|
default_type application/octet-stream;
|
||||||
|
sendfile on;
|
||||||
|
keepalive_timeout 65;
|
||||||
|
|
||||||
include mime.types;
|
server {
|
||||||
|
listen 80;
|
||||||
|
server_name localhost;
|
||||||
|
|
||||||
set_real_ip_from 0.0.0.0/0;
|
root /usr/share/nginx/html;
|
||||||
real_ip_recursive on;
|
index index.html;
|
||||||
real_ip_header X-Forward-For;
|
|
||||||
limit_req_zone $binary_remote_addr zone=mylimit:10m rate=10r/s;
|
|
||||||
|
|
||||||
server {
|
location / {
|
||||||
listen 80;
|
try_files $uri $uri/ /index.html;
|
||||||
server_name localhost;
|
|
||||||
root /proxy;
|
|
||||||
limit_req zone=mylimit burst=70 nodelay;
|
|
||||||
|
|
||||||
location / {
|
|
||||||
root /usr/share/nginx/html;
|
|
||||||
index index.html index.htm;
|
|
||||||
try_files $uri /index.html;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
error_page 500 502 503 504 /50x.html;
|
error_page 500 502 503 504 /50x.html;
|
||||||
location = /50x.html {
|
location = /50x.html {
|
||||||
root /usr/share/nginx/html;
|
root /usr/share/nginx/html;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
events {}
|
|
||||||
|
|||||||
Reference in New Issue
Block a user