I'm new to docker.How can I start a node service via docker-compose, which then accepts npm commands?
docker-compose up -d --build <-- I use this command to start
I want the npm install
to be executed and then I can enter e.g. npm mix
or npm gulp
or node -v
or npm install node-sass --save-dev
in the container. The package.json
should be saved on my local machine (if i use npm install xyz
).
my Dockerfile
FROM node:14-alpineWORKDIR /var/www/html COPY ["package.json", "package-lock.json*", "npm-shrinkwrap.json*", "./"]RUN npm installCOPY . .EXPOSE 3000
my docker-compose.yml
services: node: build: ./ stdin_open: true tty: true volumes: - ./:/app