How to copy in node Dockerfile (folders both in container)

  docker, dockerfile

This is different than questions about copying from host to container.

I’m trying to copy the build folder to the nginx html folder. I don’t know what copy command I should use, as cp didn’t work.

My dockerfile segment (see the RUN copy command which isn’t working)

FROM node:12.14.1 # If syntax is off, please ignore

WORKDIR /app
COPY . /app

RUN rm -rf node_modules &&
    npm ci &&
    npm run build # MAKES BUILD IN /app/build

# set up html files
COPY config/nginx.conf /etc/nginx/conf.d/default.conf
RUN cp /app/build /usr/share/nginx/html # BROKEN - HOW TO COPY STATIC FILES HERE?

Source: Dockerfile Questions

LEAVE A COMMENT