docker-compose remote interpreter volumes

Here's my docker-compose.yml

 

version: '3'
services:

# Main application
app:
restart: always
build:
context: ./containers/app/
args:
- SSH_PRIVATE_KEY
env_file:
- ./config/env/files/app.env
volumes:
- ./containers/app/bin/:/app/bin/
- ./containers/app/src/:/app/code/src/
- ./containers/app/config/:/app/config/
- ./containers/app/config/postfix/main.cf:/etc/postfix/main.cf
- ./.git/:/app/.git/
- ./logs/app/:/app/logs/
# the line below mounts the XXXX repository at /lib for development.
# this should be commented out on any environment except dev
- ./containers/app/lib/:/app/code/lib/
- app_data:/app/data/
depends_on:
- postgres
ports:
- 8000:8000

# Main database server
postgres:
build: ./containers/postgres/
restart: unless-stopped
env_file:
- ./config/env/files/postgres.env
volumes:
- postgres_data:/var/lib/postgresql/data
ports:
- 5432:5432

volumes:
postgres_data:
app_data:

 

My Django app's static data ends up in `/app/data/static`, but any changes made to the static content from within the container (e.g. by Grunt process that watches on CSS/JS changes) isn't reflected outside the container, which makes me wonder if the volumes are even taking effect.

Or is there perhaps something which I'm missing with the run configuration?

 

0
3 comments

PyCharm works around the idea that you work with files locally and then can run them inside the container. It doesn't take into account changes made to the files inside the container.

If the files on the local machine are changed by an external process, then PyCharm should detect it.

0

I'm trying to determine why changes inside a container is visible outside if I'm NOT using PyCharm.

Please help me get this work.

In my docker-compose.yml file you'll see a named volume:

app_data:/app/data/

This is where the in-container Grunt process puts compiled JS/CSS, in /app/data/static

How do I get PyCharm to honour this named volume?

One more thing: docker-compose up accepts "--renew-anon-volumes" on the CLI, but if I try to add that to the run configuration, then PyCharm gives me an error.

 

 

 

0

>I'm trying to determine why changes inside a container is visible outside if I'm NOT using PyCharm.

Did you copy the executed by PyCharm command and run it in the terminal?

If not, try it and let me know the result.

0

Please sign in to leave a comment.