J
J
jScheq2018-05-25 18:02:50
Docker
jScheq, 2018-05-25 18:02:50

How to mount a folder with pictures in a container without direct copying?

Good day!
In this project, the task of Express is to give static content (pictures, of which 15 gigs).
In compose, I mount the build directory - there is an attachment for node. And there is also a public directory - it contains pictures.
But the problem is that there are only 20 gigs on the server, and when I start
docker build .
docker it starts copying all the pictures into the image and naturally the place runs out.
Attention, the question is: how can I configure compose so that I can give pictures to the outside and at the same time they are not copied into the inside of the image?
docker-compose.yml

version: '3'
services:
    web:
        image: docker-node-express-mongoapp
        build: ./
        working_dir: /usr/src/app/
        command: node index.js
        ports:
            - "3001:3001"
        volumes:
            - ./build:/usr/src/app
            - /usr/src/app/node_modules
        depends_on:
            - "mongo"
        
    mongo:
        image: "mongo"
        ports: 
            - "27017:27017"

    adminmongo:
        image: "mrvautin/adminmongo"
        ports:
            - "1234:1234"

Dockerfile
FROM node

WORKDIR /usr/src/app

COPY package.json .

RUN npm install

COPY ./build/ .

EXPOSE 3001

CMD ["node", "index.js"]

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Roman Mirilaczvili, 2018-05-25
@2ord

https://docs.docker.com/storage/Volumes
: https://dzone.com/articles/demystifying-the-data-v...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question