apocas/dockerode-compose

COPY command causes compose.up process to fail

Opened this issue · 1 comments

neg-0 commented

I'm using the following Dockerfile inside of a nodejs repository.

  # Pull base image
  FROM node:latest

  # Set working directory
  WORKDIR /usr/src/app

  # Install app dependencies
  COPY package*.json ./
  RUN npm install

  # Copy app files
  COPY . .

  # Start the app
  EXPOSE 3000

  # Run the app
  CMD [ "npm", "start" ]

The COPY package*.json ./ command causes the compose.up() function to fail due to the way source files are configured in serviceTools.js

if (dockerfile !== null) {
obj['dockerfile'] = path.basename(dockerfile);
let streami = await docker.buildImage(
{
context: buildPath,
src: [dockerfile],
},
obj
);

According to the dockerode docs https://github.com/apocas/dockerode#building-an-image, the value of src must include ALL files that will be referenced in a command such as COPY. Is there a workaround or plan to include files other than Dockerfile in the source files array?

neg-0 commented

Dove more into the servicesTools.buildDockerImage function and saw that it uses the tarball method if a dockerfile is not specified in the docker-compose.yml. I removed the dockerfile (which was pointing to the default 'Dockerfile' name anyway) and it seems to be working now.

What is the intended use of defining a dockerfile?