Skip to content

Commit

Permalink
update deploy script and conf
Browse files Browse the repository at this point in the history
  • Loading branch information
itsmostafa committed Nov 26, 2024
1 parent f3e6af0 commit 61a2ef3
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 3 deletions.
4 changes: 3 additions & 1 deletion deploy/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ dzdo docker run -d --rm \
--env-file .env \
-p 80:80 -p 443:433 \
--name resdeeds-web \
-v ./etc/ssl:/etc/ssl
-v ./etc/ssl:/etc/ssl \
-v ./etc/nginx:/etc/nginx/conf.d \
-v /var/log/nginx:/var/log/nginx \
ghcr.io/idaholab/resdeeds/web:latest

echo "Deployed"
2 changes: 0 additions & 2 deletions web/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ RUN ng build --configuration=production

FROM nginx:alpine

COPY etc/nginx.conf /etc/nginx/conf.d/default.conf

COPY --from=build /var/www/dist/resdeeds /usr/share/nginx/html

EXPOSE 80 443 4200
Expand Down
45 changes: 45 additions & 0 deletions web/etc/nginx/default.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
server {
listen 443 ssl;
server_name localhost;

# Path to SSL certificate and key
ssl_certificate /etc/ssl/certs/localhost.cer;
ssl_certificate_key /etc/ssl/private/localhost.key;

# Root directory for the Angular app
root /usr/share/nginx/html;

# Default file to serve
index index.html;

# Redirect HTTP traffic to HTTPS
error_page 404 /index.html;

# Handle Angular's HTML5 pushState
location / {
try_files $uri $uri/ /index.html;
}

# Optional: Gzip compression for improved performance
gzip on;
gzip_types text/plain application/javascript text/css application/json application/xml text/javascript;
gzip_min_length 1024;
}


server {
listen 80;
server_name localhost;

# Serve static files from /usr/share/nginx/html
location / {
root /usr/share/nginx/html;
index index.html index.htm;
}

# Error pages
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}

0 comments on commit 61a2ef3

Please sign in to comment.