Use nginx server to host files and handle page reloads

This commit is contained in:
Nabarun 2023-12-08 14:58:48 +05:30
parent 6b575f7576
commit 746447f5fc
3 changed files with 25 additions and 9 deletions

View File

@ -12,19 +12,19 @@ services:
- ../config/osmosis/build-app.sh:/app/packages/web/build-app.sh
- app_builds:/app-builds
python-server:
image: python:3
nginx:
image: nginx:1.23-alpine
restart: always
depends_on:
osmosis-front-end:
condition: service_completed_successfully
restart: on-failure
command: ["python3", "-m", "http.server", "-d" ,"/app-builds/osmosis/build", "3000"]
volumes:
- app_builds:/app-builds
- ../config/osmosis/nginx:/etc/nginx/conf.d
- app_builds:/usr/share/nginx
ports:
- "3000"
- "80"
healthcheck:
test: ["CMD", "nc", "-vz", "localhost", "3000"]
test: ["CMD", "nc", "-vz", "localhost", "80"]
interval: 20s
timeout: 5s
retries: 15

View File

@ -0,0 +1,16 @@
server {
listen 80;
listen [::]:80;
server_name _;
error_page 500 502 503 504 /50x.html;
location / {
root /usr/share/nginx/osmosis/build;
index index.html index.htm index.nginx-debian.html;
# First attempt to serve request as file, then as html,
# then as directory, then fall back to displaying a 404.
try_files $uri $uri.html $uri/ /index.html =404;
}
}

View File

@ -42,8 +42,8 @@ network:
ports:
proxy-server:
- '4000:4000'
python-server:
- '3000:3000'
niginx:
- '3000:80'
```
### Data volumes