Skip to content

Commit

Permalink
created dockerfile for proxy
Browse files Browse the repository at this point in the history
  • Loading branch information
AndrewKassab committed Sep 17, 2024
1 parent 89efc4f commit 0266e80
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 0 deletions.
24 changes: 24 additions & 0 deletions proxy/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
FROM nginxinc/nginx-unprivileged:1-alpine
LABEL maintainer="[email protected]"

COPY ./default.conf.tpl /etc/nginx/default.conf.tpl
COPY ./uwsgi_params /etc/nginx/uwsgi_params
COPY ./run.sh /run.sh

ENV LISTEN_PORT=8000
ENV APP_HOST=app
ENV APP_PORT=9000

USER root

RUN mkdir -p /vol/static && \
chmod 755 /vol/static && \
touch /etc/nginx/conf.d/default.conf && \
chown nginx:nginx /etc/nginx/conf.d/default.conf && \
chmod +x /run.sh

VOLUME /vol/static

USER nginx

CMD ["/run.sh"]
13 changes: 13 additions & 0 deletions proxy/default.conf.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
server {
listen $(LISTEN_PORT};

location /static {
alias /vol/static;
}

location / {
uwsgi_pass ${APP_HOST}:${APP_PORT};
include /etc/nginx/uwsgi_params;
client_max_body_size 10M;
}
}
6 changes: 6 additions & 0 deletions proxy/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/sh

set -e

envsubst < /etc/nginx/default.conf.tpl > /etc/nginx/conf.d/default.conf
nginx -g 'daemon off;'
13 changes: 13 additions & 0 deletions proxy/uwsgi_params
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
uwsgi_param QUERY_STRING $query_string;
uwsgi_param REQUEST_METHOD $request_method;
uwsgi_param CONTENT_TYPE $content_type;
uwsgi_param CONTENT_LENGTH $content_length;
uwsgi_param REQUEST_URI $request_uri;
uwsgi_param PATH_INFO $document_uri;
uwsgi_param DOCUMENT_ROOT $document_root;
uwsgi_param SERVER_PROTOCOL $server_protocol;
uwsgi_param REMOTE_ADDR $remote_addr;
uwsgi_param REMOTE_PORT $remote_port;
uwsgi_param SERVER_ADDR $server_addr;
uwsgi_param SERVER_PORT $server_port;
uwsgi_param SERVER_NAME $server_name;

0 comments on commit 0266e80

Please sign in to comment.