diff --git a/.github/workflows/docker-build.yaml b/.github/workflows/docker-build.yaml index b5192d4..ba46e05 100644 --- a/.github/workflows/docker-build.yaml +++ b/.github/workflows/docker-build.yaml @@ -3,6 +3,9 @@ name: Build and publish Docker image on: push: branches: [ main, staging ] + paths: + - 'dist/**' + - 'docker/**' jobs: build-and-push-image: diff --git a/docker/dockerfile b/docker/dockerfile index 1d576e2..6f69f01 100644 --- a/docker/dockerfile +++ b/docker/dockerfile @@ -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 diff --git a/nginx.conf b/nginx.conf new file mode 100644 index 0000000..b302955 --- /dev/null +++ b/nginx.conf @@ -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"; + } + } +} \ No newline at end of file