Exceptions in .dockerignore

后端 未结 3 1178
天命终不由人
天命终不由人 2021-01-11 19:35

How does .dockerignore handle exceptions?

For example, I would like to ignore everything from the src/ directory except for src/web/p

3条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-01-11 20:02

    Using my response to another question https://stackoverflow.com/a/51429852/2419069 you can use the following .dockerignore file:

    # Ignore everything
    **
    
    # Allow /src/web/public directory
    !/src/web/public/**
    
    # You can also ignore unnecessary files inside the /src/web/public to make your image even smaller.
    **/*~
    **/*.log
    **/.DS_Store
    **/Thumbs.db
    

提交回复
热议问题