'Docker volumes + django

i have Dockerfile with python

FROM python:3.8
ENV PYTHONBUFFERED 1

WORKDIR /app

COPY requirements.txt .
RUN pip install -r requirements.txt

COPY . .

EXPOSE 8000

COPY --from=node /app/src/barbook_app/static /app/src/barbook_app/static

RUN python src/manage.py collectstatic --noinput

CMD python3 -m spacy download en && python3 src/manage.py migrate && python3 src/manage.py initadmin && \
 gunicorn barbook_project.wsgi --chdir src --bind 0.0.0.0 --preload --log-file -


And docker-compose

app: &app
    build:
      context: .
      dockerfile: deploy/python/Dockerfile
    restart: always
    ports:
      - 8000:8000
    expose:
      - 8000
    depends_on:
      - postgres
      - redis
    environment:
      DB_NAME: barbook_django
      DB_USER: root
      DB_PASSWORD: root
      DB_HOST: postgres
      DB_PORT: 5432
      REDIS_CONNECTION: redis://redis:6379/0
    volumes:
      - ./static:/app/static/
      - ./img_source:/app/img_source

the problem is when i do docker-copose like this. no static-files appeared

but when i map like this

  • static:/app/static/

everything is fine.

What's the problem ?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source