diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 7ce69e6..9e0eca6 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -23,7 +23,10 @@ jobs: cd app/python-uri-shortener echo "Welcome!" git pull origin main + docker pull nginx:latest + sudo systemctl start nginx docker login -u stefnie -p ${{ secrets.docker_hub_token }} docker pull stefnie/api-image:latest docker pull stefnie/api-image:latest + sudo nginx -t docker-compose -f compose.yaml up -d diff --git a/compose.yaml b/compose.yaml index 5c7c6be..4b8a50c 100644 --- a/compose.yaml +++ b/compose.yaml @@ -12,4 +12,11 @@ services: container_name: build2 network_mode: "host" volumes: - - ./app/api.py:/app/api.py \ No newline at end of file + - ./app/api.py:/app/api.py + + nginx: + image: nginx:latest + container_name: nginx + network_mode: "host" + volumes: + - ./nginx/conf.d/default.conf:/etc/nginx/sites-available/default diff --git a/nginx/conf.d/default.conf b/nginx/conf.d/default.conf new file mode 100644 index 0000000..2457f90 --- /dev/null +++ b/nginx/conf.d/default.conf @@ -0,0 +1,10 @@ +server { + listen 80; + server_name 52.23.155.226; + location / { + proxy_pass http://backend:8080; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + } +} \ No newline at end of file