COPY with docker but with exclusion

前端 未结 7 2135
轮回少年
轮回少年 2020-12-12 11:48

In a Dockerfile, I have

COPY . .

I want to exclude an entire directory, in my case, node_modules directory.

Something like this:

7条回答
  •  误落风尘
    2020-12-12 12:31

    FOR A ONE LINER SOLUTION, type the following in Command prompt or Terminal at project root.

    echo node_modules > .dockerignore

    This creates the extension-less . prefixed file without any issue. Replace node_modules with the folder you want to exclude.

提交回复
热议问题