diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..61f3b23 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,9 @@ +FROM nginx:latest +ENV NGINX_ENVSUBST_OUTPUT_DIR=/etc/nginx + +ENV APP_PORT=80 +ENV APP_NAME= + +COPY ./nginx.conf /etc/nginx/templates/nginx.conf.template + +CMD ["nginx", "-g", "daemon off;"] \ No newline at end of file diff --git a/compose.yaml b/compose.yaml new file mode 100644 index 0000000..0918ce9 --- /dev/null +++ b/compose.yaml @@ -0,0 +1,15 @@ +version: '3.4' +services: + lb: + build: . + environment: + - APP_PORT=2001 + - APP_NAME=whoami + ports: + - "8081:80" + + whoami: + image: traefik/whoami + command: + # It tells whoami to start listening on 2001 instead of 80 + - --port=2001 diff --git a/nginx.conf b/nginx.conf new file mode 100644 index 0000000..aefdf8a --- /dev/null +++ b/nginx.conf @@ -0,0 +1,14 @@ +user nginx; + +events { + worker_connections 1000; +} + +http { + server { + listen 80; + location / { + proxy_pass http://${APP_NAME}:${APP_PORT}; + } + } +} \ No newline at end of file