feat(frontend): add Dockerfile and nginx.conf for ConfigMap
This commit is contained in:
parent
3b95fcef33
commit
4d41c2cc7c
14
frontend/Dockerfile
Normal file
14
frontend/Dockerfile
Normal file
@ -0,0 +1,14 @@
|
||||
FROM nginx:alpine
|
||||
|
||||
# Static assets
|
||||
COPY index.html /usr/share/nginx/html/
|
||||
COPY style.css /usr/share/nginx/html/
|
||||
COPY app.js /usr/share/nginx/html/
|
||||
|
||||
# nginx.conf is provided at runtime via ConfigMap mount.
|
||||
# We do NOT copy it into the image; the default nginx.conf in the image
|
||||
# would be used if the ConfigMap mount is missing.
|
||||
|
||||
EXPOSE 80
|
||||
|
||||
CMD ["nginx", "-g", "daemon off;"]
|
||||
38
nginx.conf
Normal file
38
nginx.conf
Normal file
@ -0,0 +1,38 @@
|
||||
worker_processes 1;
|
||||
|
||||
events {
|
||||
worker_connections 1024;
|
||||
}
|
||||
|
||||
http {
|
||||
include mime.types;
|
||||
default_type application/octet-stream;
|
||||
sendfile on;
|
||||
keepalive_timeout 65;
|
||||
|
||||
large_client_header_buffers 4 32k;
|
||||
|
||||
upstream api_backend {
|
||||
server api:5000;
|
||||
}
|
||||
|
||||
server {
|
||||
listen 80;
|
||||
server_name localhost;
|
||||
|
||||
root /usr/share/nginx/html;
|
||||
index index.html;
|
||||
|
||||
location / {
|
||||
try_files $uri $uri/ /index.html;
|
||||
}
|
||||
|
||||
location /api/ {
|
||||
proxy_pass http://api_backend;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user