Commit 4a33d06f authored by carlosribas's avatar carlosribas
Browse files

Use volume to serve static files

parent 86868400
...@@ -49,12 +49,11 @@ RUN \ ...@@ -49,12 +49,11 @@ RUN \
git clone -b "$BRANCH" https://github.com/RNAcentral/rnacentral-webcode.git && \ git clone -b "$BRANCH" https://github.com/RNAcentral/rnacentral-webcode.git && \
pip install -r $RNACENTRAL_HOME/rnacentral-webcode/rnacentral/requirements.txt && \ pip install -r $RNACENTRAL_HOME/rnacentral-webcode/rnacentral/requirements.txt && \
pip install gunicorn && \ pip install gunicorn && \
cd $RNACENTRAL_HOME/rnacentral-webcode/rnacentral/portal/static && npm install --only=production cd $RNACENTRAL_HOME/rnacentral-webcode/rnacentral/portal/static && npm install --only=production && \
mkdir $RNACENTRAL_HOME/static
WORKDIR $RNACENTRAL_HOME/rnacentral-webcode
COPY ./entrypoint.sh /entrypoint.sh COPY ./entrypoint.sh /entrypoint.sh
ENTRYPOINT [ "/entrypoint.sh" ] ENTRYPOINT [ "/entrypoint.sh" ]
# Expose a container port where the website is served
EXPOSE 8000
CMD [ "/bin/sh", "-c", "/usr/bin/supervisord -c ${SUPERVISOR_CONF_DIR}/supervisord.conf" ] CMD [ "/bin/sh", "-c", "/usr/bin/supervisord -c ${SUPERVISOR_CONF_DIR}/supervisord.conf" ]
...@@ -7,7 +7,6 @@ services: ...@@ -7,7 +7,6 @@ services:
context: . context: .
args: args:
- RNACENTRAL_BRANCH=${RNACENTRAL_BRANCH} - RNACENTRAL_BRANCH=${RNACENTRAL_BRANCH}
dockerfile: Dockerfile-development
environment: environment:
- DB_HOST=${DB_HOST} - DB_HOST=${DB_HOST}
- DB_NAME=${DB_NAME} - DB_NAME=${DB_NAME}
...@@ -15,6 +14,10 @@ services: ...@@ -15,6 +14,10 @@ services:
- DB_PASSWORD=${DB_PASSWORD} - DB_PASSWORD=${DB_PASSWORD}
- DB_PORT=${DB_PORT} - DB_PORT=${DB_PORT}
- SECRET_KEY=${SECRET_KEY} - SECRET_KEY=${SECRET_KEY}
expose:
- 8000
volumes:
- static_volume:/srv/rnacentral/static
depends_on: depends_on:
- redis - redis
networks: networks:
...@@ -26,7 +29,7 @@ services: ...@@ -26,7 +29,7 @@ services:
redis: redis:
image: redis:6.0.8-alpine image: redis:6.0.8-alpine
ports: ports:
- "8051:8051" - 8051:8051
command: redis-server --port 8051 command: redis-server --port 8051
restart: always restart: always
networks: networks:
...@@ -39,7 +42,7 @@ services: ...@@ -39,7 +42,7 @@ services:
- 8000:80 - 8000:80
volumes: volumes:
- ../nginx/conf.d:/etc/nginx/conf.d - ../nginx/conf.d:/etc/nginx/conf.d
- ../rnacentral/portal/static/:/static - static_volume:/srv/rnacentral/static
depends_on: depends_on:
- rnacentral - rnacentral
networks: networks:
...@@ -49,13 +52,16 @@ services: ...@@ -49,13 +52,16 @@ services:
memcached: memcached:
image: memcached:1.6.7-alpine image: memcached:1.6.7-alpine
ports: ports:
- "8052:8052" - 8052:8052
command: memcached -m 512m -p 8052 command: memcached -m 512m -p 8052
depends_on: depends_on:
- rnacentral - rnacentral
networks: networks:
- memcached-network - memcached-network
volumes:
static_volume:
networks: networks:
redis-network: redis-network:
driver: bridge driver: bridge
......
...@@ -5,15 +5,17 @@ upstream rnacentral { ...@@ -5,15 +5,17 @@ upstream rnacentral {
server { server {
listen 80; listen 80;
server_name localhost;
location / { location / {
# everything is passed to Gunicorn # everything is passed to Gunicorn
proxy_pass http://rnacentral; proxy_pass http://rnacentral;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
proxy_redirect off;
} }
location /static/ { location /static/ {
autoindex on; autoindex on;
alias /static/; alias /srv/rnacentral/static/;
} }
} }
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment