Volume to share files from docker container to host in elastic beanstalk single container

Viewed 310

I'm trying to share the static files from my container to the host so that nginx can serve them. This is on AWS elastic beanstalk using the Docker single container platform.

I have verified that the static files have been generated in the container, however the files are not found in the host directory.

The project is otherwise working fine, deployed with eb deploy. Can someone tell me where did I go wrong? Thanks!

Dockerrun.aws.json:

{
    "AWSEBDockerrunVersion": "1",
    "Volumes": [
        {
            "HostDirectory": "/var/www/static",
            "ContainerDirectory": "/code/my_app/static"
        }
    ]
}

Dockerfile:

FROM python:3.6
ENV PYTHONUNBUFFERED 1

ARG requirements=requirements/production.txt
ENV DJANGO_SETTINGS_MODULE=my_app.settings.production

RUN mkdir /code
WORKDIR /code
COPY requirements/ /code/requirements/ 
RUN pip install --upgrade pip
RUN pip install -r $requirements

STOPSIGNAL SIGINT

ADD . /code/

EXPOSE 8000

COPY ./entrypoint_prod.sh /
ENTRYPOINT ["/entrypoint_prod.sh"]

entrypoint_prod.sh

python manage.py collectstatic --no-input
gunicorn my_app.wsgi:application --bind 0.0.0.0:8000
python manage.py process_tasks
0 Answers
Related