I've got a Javascript helper file that contains general functions
Instead of duplicating it to both my containers (Node server and Vue frontend application) I thought I'll try creating a volume and sharing it between my containers So I've put it inside a folder called "Shared" in my root directory above my client and server folder which I turn into containers.
file system structure on my local machine:
root
--server
--client
--shared
--docker-compose.yml
Dockerfile
FROM node:latest as builder
WORKDIR /app
COPY package.json .
RUN npm install
COPY . ./
ENV PORT 8000
EXPOSE $PORT
RUN npm run build
Docker-compose.yml file
client:
build:
context: ./client
args:
NODE_ENV: production
volumes:
- ./client:/app
- /app/node_modules
- type: bind
source: ./shared
target: /app/src/shared
environment:
- NODE_ENV=production
When I go into my container exec -it container_name bash and go into the directory i created, I can find the file there ! it was shared and is inside the container
But I cannot access it from my local machine - so I can't actually use it because its not actually created in a way that is useable for me when writing my code it just sits my in my container - inaccessible
Any ideas what I'm missing?