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

Use volume to serve static files

parent 86868400
......@@ -49,12 +49,11 @@ RUN \
git clone -b "$BRANCH" https://github.com/RNAcentral/rnacentral-webcode.git && \
pip install -r $RNACENTRAL_HOME/rnacentral-webcode/rnacentral/requirements.txt && \
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
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" ]
......@@ -7,7 +7,6 @@ services:
context: .
args:
- RNACENTRAL_BRANCH=${RNACENTRAL_BRANCH}
dockerfile: Dockerfile-development
environment:
- DB_HOST=${DB_HOST}
- DB_NAME=${DB_NAME}
......@@ -15,6 +14,10 @@ services:
- DB_PASSWORD=${DB_PASSWORD}
- DB_PORT=${DB_PORT}
- SECRET_KEY=${SECRET_KEY}
expose:
- 8000
volumes:
- static_volume:/srv/rnacentral/static
depends_on:
- redis
networks:
......@@ -26,7 +29,7 @@ services:
redis:
image: redis:6.0.8-alpine
ports:
- "8051:8051"
- 8051:8051
command: redis-server --port 8051
restart: always
networks:
......@@ -39,7 +42,7 @@ services:
- 8000:80
volumes:
- ../nginx/conf.d:/etc/nginx/conf.d
- ../rnacentral/portal/static/:/static
- static_volume:/srv/rnacentral/static
depends_on:
- rnacentral
networks:
......@@ -49,13 +52,16 @@ services:
memcached:
image: memcached:1.6.7-alpine
ports:
- "8052:8052"
- 8052:8052
command: memcached -m 512m -p 8052
depends_on:
- rnacentral
networks:
- memcached-network
volumes:
static_volume:
networks:
redis-network:
driver: bridge
......
......@@ -5,15 +5,17 @@ upstream rnacentral {
server {
listen 80;
server_name localhost;
location / {
# everything is passed to Gunicorn
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/ {
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