Skip to content

Commit

Permalink
Improve Dockerfile and nginx.conf to enhance Angular app deployment s…
Browse files Browse the repository at this point in the history
…tability
  • Loading branch information
vasgat committed Nov 22, 2024
1 parent 1a08318 commit aafe61f
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
3 changes: 3 additions & 0 deletions docker/dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ FROM nginx:latest
# Copy your static site files to the Nginx default directory
COPY ../dist/msa-dashboard /usr/share/nginx/html

# Copy custom Nginx configuration
COPY nginx.conf /etc/nginx/nginx.conf

# Expose port 80 to allow traffic
EXPOSE 80

Expand Down
29 changes: 29 additions & 0 deletions nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
worker_processes 1;

events { worker_connections 1024; }

http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;

server {
listen 80;
server_name localhost;

root /usr/share/nginx/html;

# Serve Angular routes correctly
location / {
try_files $uri $uri/ /index.html;
}

# Optional: Cache static files
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ {
try_files $uri =404;
expires 1M;
add_header Cache-Control "public";
}
}
}

0 comments on commit aafe61f

Please sign in to comment.