简体   繁体   中英

Files not sync on docker-compose

After building my image (with tag succli/backoffice ), my files not synchronizing. I created an entrypoint.sh, but it's not in the container. As editor I use Visual Studio Code on Ubuntu.

My Dockerfile :

FROM node:8

EXPOSE 3000

COPY . /opt/app

WORKDIR /opt/app

RUN npm install
CMD npm run-script prod

My docker-compose.yml :

version: "2"
services:
  web:
    image: succli/backoffice:latest
    ports:
      - "3000"
    links:
      - mongo
    environment:
      - DATABASE=mongodb://mongo:27017/backoffice

  mongo:
    image: mongo:latest

and docker-compose.vols.yml :

version: "2"
services:
  web:
    ports:
      - "32781:3000"
    environment:
      - DOMAIN=localhost:32781
    volumes:
      - /home/succ/www/backoffice:/opt/app
    entrypoint: /opt/app/entypoint.sh

  mongo:
    ports:
      - "27018:27017"

After running docker-compose -f docker-compose.yml up the changes or the new files are not visible in the container (checking it with docker exec -ti backoffice_web_1 /bin/bash )

Docker version 17.09.1-ce, build 19e2cf6
docker-compose version 1.8.0, build unknown

Looking at your Dockerfile I would expect (as I am not completely clear about your question) that you need to ADD your files to the image before you can RUN npm install

In order to run npm install you need a package.json so you should ADD it in the dockerfile before the RUN and all other files needed.

In the docker-compose.yml file you can define both services as it composes your chain of services...

Hope it helps. If not than please provide a more detailed question...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM