Browse Source

Nginx is now part of SAPL container

pull/1063/head
Fábio Kaiser Rauber 8 years ago
parent
commit
ba8bc9ea75
  1. 32
      Dockerfile
  2. 31
      config/nginx/nginx.conf
  3. 7
      start.sh

32
Dockerfile

@ -4,31 +4,37 @@ ENV BUILD_PACKAGES postgresql-dev graphviz-dev graphviz build-base git pkgconfig
python3-dev libxml2-dev jpeg-dev libressl-dev libffi-dev libxslt-dev nodejs py3-lxml \ python3-dev libxml2-dev jpeg-dev libressl-dev libffi-dev libxslt-dev nodejs py3-lxml \
py3-magic postgresql-client vim py3-magic postgresql-client vim
RUN apk add --no-cache python3 && \ RUN apk add --no-cache python3 nginx && \
python3 -m ensurepip && \ python3 -m ensurepip && \
rm -r /usr/lib/python*/ensurepip && \ rm -r /usr/lib/python*/ensurepip && \
pip3 install --upgrade pip setuptools && \ pip3 install --upgrade pip setuptools && \
rm -r /root/.cache rm -r /root/.cache && \
rm -f /etc/nginx/conf.d/*
RUN mkdir -p /var/interlegis/sapl &&\ RUN mkdir -p /var/interlegis/sapl && \
apk add --update --no-cache $BUILD_PACKAGES && \ apk add --update --no-cache $BUILD_PACKAGES && \
npm install -g bower npm install -g bower && \
npm cache clean
# Bower aceitar root
RUN touch /root/.bowerrc \
&& chmod 751 /root/.bowerrc \
&& echo "{ \"allow_root\": true }" >> /root/.bowerrc \
&& npm cache clean
WORKDIR /var/interlegis/sapl/ WORKDIR /var/interlegis/sapl/
ADD . /var/interlegis/sapl/ ADD . /var/interlegis/sapl/
COPY start.sh /var/interlegis/sapl/ COPY start.sh /var/interlegis/sapl/
COPY config/nginx/sapl.conf /etc/nginx/conf.d
COPY config/nginx/nginx.conf /etc/nginx/nginx.conf
RUN pip install -r /var/interlegis/sapl/requirements/requirements.txt --upgrade setuptools && \
rm -r /root/.cache && \
rm -r /tmp/*
RUN chmod +x /var/interlegis/sapl/start.sh RUN python3 manage.py bower install -- --allow-root && \
python3 manage.py collectstatic --no-input
RUN pip install -r /var/interlegis/sapl/requirements/requirements.txt --upgrade setuptools RUN chmod +x /var/interlegis/sapl/start.sh && \
ln -sf /dev/stdout /var/log/nginx/access.log && \
ln -sf /dev/stderr /var/log/nginx/error.log
VOLUME ["/var/interlegis/sapl/data", "/var/interlegis/sapl/media", "/var/interlegis/sapl/collected_static"] VOLUME ["/var/interlegis/sapl/data", "/var/interlegis/sapl/media", "/var/interlegis/sapl/collected_static"]
ENTRYPOINT ["/var/interlegis/sapl/start.sh"]
CMD ["/var/interlegis/sapl/start.sh"]

31
config/nginx/nginx.conf

@ -0,0 +1,31 @@
user nginx;
worker_processes 1;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile off;
#tcp_nopush on;
keepalive_timeout 65;
#gzip on;
include /etc/nginx/conf.d/*.conf;
}

7
start.sh

@ -40,12 +40,12 @@ create_env() {
create_env create_env
python3 manage.py bower install #python3 manage.py bower install
/bin/sh busy-wait.sh $DATABASE_URL /bin/sh busy-wait.sh $DATABASE_URL
python3 manage.py migrate python3 manage.py migrate
python3 manage.py collectstatic --no-input #python3 manage.py collectstatic --no-input
python3 manage.py rebuild_index --noinput python3 manage.py rebuild_index --noinput
user_created=$(python3 create_admin.py 2>&1) user_created=$(python3 create_admin.py 2>&1)
@ -66,4 +66,5 @@ if [ $lack_pwd -eq 0 ]; then
fi fi
/bin/sh gunicorn_start.sh no-venv /bin/sh gunicorn_start.sh no-venv &
/usr/sbin/nginx -g "daemon off;"

Loading…
Cancel
Save