Skip to content

Commit

Permalink
Create an ngnix container to serve the content
Browse files Browse the repository at this point in the history
  • Loading branch information
nck974 committed Mar 10, 2024
1 parent dfc4986 commit 8db92b3
Show file tree
Hide file tree
Showing 7 changed files with 84 additions and 9 deletions.
29 changes: 22 additions & 7 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -1,24 +1,39 @@
version: "3.8"

services:
flight-combinanation-finder:
container_name: flight-combinanation-finder
ngnix:
container_name: nginx
image: nck974/flight-combination-finder-ngnix:1.0.3
restart: unless-stopped
depends_on:
- flightcombinationfinder
- flightcombinationfinderng
ports:
- 443:443
- 80:80
environment:
- NGINX_HOST=${SERVER_IP}
volumes:
- ./ssl/:/etc/nginx/ssl/:ro

flightcombinationfinder:
container_name: flightcombinationfinder
image: nck974/flight-combination-finder:1.0.1
restart: unless-stopped
depends_on:
- flightsdatabase
ports:
- 8080:8080

flight-combinanation-finder-ng:
container_name: flight-combinanation-finder-ng
image: nck974/flight-combination-finder-ng:1.0.1
flightcombinationfinderng:
container_name: flightcombinationfinderng
image: nck974/flight-combination-finder-ng:1.0.2
restart: unless-stopped
depends_on:
- flightsdatabase
- flight-combinanation-finder
- flightcombinationfinder
environment:
- BACKEND_URL=http://${SERVER_IP}:8080/backend
- BACKEND_URL=https://${SERVER_IP}/backend
ports:
- 8081:80

Expand Down
2 changes: 2 additions & 0 deletions flight-combination-finder-ng/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# docker build -f Dockerfile -t nck974/flight-combination-finder-ng:1.0.3 . --no-cache
# docker push nck974/flight-combination-finder-ng:1.0.3
#################
# Build the app #
#################
Expand Down
2 changes: 1 addition & 1 deletion flight-combination-finder-ng/src/assets/env.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@

// Environment variables
window["env"]["production"] = false;
window["env"]["backendURL"] = "http://localhost:8080/backend";
window["env"]["backendUrl"] = "http://localhost:8080/backend";
window["env"]["debug"] = true;
})(this);
2 changes: 1 addition & 1 deletion flight-combination-finder-ng/src/assets/env.template.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@

// Environment variables
window["env"]["production"] = "${PRODUCTION}";
window["env"]["backendURL"] = "${BACKEND_URL}s";
window["env"]["backendUrl"] = "${BACKEND_URL}";
window["env"]["debug"] = "${DEBUG}";
})(this);
6 changes: 6 additions & 0 deletions nginx/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# cd ngnix
# docker build -t nck974/flight-combination-finder-ngnix:1.0.1 .
# docker push nck974/flight-combination-finder-ngnix:1.0.1
FROM nginx:1.25.2
COPY nginx.conf /etc/nginx/nginx.conf
COPY ssl.conf /etc/nginx/conf.d/ssl.conf
44 changes: 44 additions & 0 deletions nginx/nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
events {

}

http {
server {
listen 80;

http2 on;

server_name $hostname;

return 301 https://$host$request_uri;
}

server {
listen 443 default_server ssl;
listen [::]:443 ssl; # ipv6

http2 on;

server_name $hostname;

# Configure ssl
include /etc/nginx/conf.d/ssl.conf;

# Hide server versions
server_tokens off;

# Allow uploads of larger files
client_max_body_size 20M;

# Configure paths
location /backend {
proxy_pass http://flightcombinationfinder:8080/backend;
}

location / {
proxy_pass http://flightcombinationfinderng:80;
}

}

}
8 changes: 8 additions & 0 deletions nginx/ssl.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Enable SSL
ssl_certificate /etc/nginx/ssl/cert.pem;
ssl_certificate_key /etc/nginx/ssl/cert.key;
ssl_ciphers EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH;
ssl_prefer_server_ciphers on;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 10m;

0 comments on commit 8db92b3

Please sign in to comment.