From 647f0bc166c6fa0cee2386b9e2d35a36234fa5da Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Tom=C3=A1=C5=A1?= <git@imaniti.org>
Date: Thu, 5 Jan 2023 11:54:21 +0100
Subject: [PATCH] add docker nginx image

---
 .gitlab-ci.yml |  8 ++++++++
 nginx.conf     | 23 +++++++++++++++++++++++
 2 files changed, 31 insertions(+)
 create mode 100644 nginx.conf

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 0cd1800..cae401b 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -20,3 +20,11 @@ build_app:
     - docker pull $CI_REGISTRY_IMAGE:test || true
     - docker build --cache-from $CI_REGISTRY_IMAGE:test -t $IMAGE_TAG_APP .
     - docker push $IMAGE_TAG_APP
+
+build_nginx:
+  stage: build
+  when: manual
+  script:
+    - docker pull $CI_REGISTRY_IMAGE:test-nginx || true
+    - docker build --cache-from $CI_REGISTRY_IMAGE:test-nginx -t $IMAGE_TAG_NGINX . -f Dockerfile.nginx
+    - docker push $IMAGE_TAG_NGINX
diff --git a/nginx.conf b/nginx.conf
new file mode 100644
index 0000000..1ed91b4
--- /dev/null
+++ b/nginx.conf
@@ -0,0 +1,23 @@
+upstream rybicka {
+    ip_hash;
+    server app:8000;
+}
+
+server {
+    server_name rybicka;
+    listen 8080;
+
+    client_max_body_size 10M;
+
+    proxy_connect_timeout   60;
+    proxy_send_timeout      60;
+    proxy_read_timeout      60;
+    send_timeout            60;
+
+    location / {
+        proxy_pass http://rybicka/;
+        proxy_set_header Host $host;
+        proxy_set_header X-Forwarded-Proto https;
+        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
+    }
+}
-- 
GitLab