Conteúdo do Curso
Docker for Python Developers
Docker for Python Developers
Dockerignore File
Previously, we used the command COPY . .
to copy all files from the directory of our project to our container. However, it's not always necessary to copy all files, for example, the venv
folder, database files, or files created by your development environment (e.g., .idea
). To avoid copying such files, we use a .dockerignore
file.
A Dockerignore file is a configuration file that tells Docker which files and folders should not be included in the Docker image build context. It allows you to specify which files or folders to ignore during the image creation process, helping to reduce the size of the image and keep it clean from unnecessary or temporary files. Each line in this file contains a pattern that specifies which files or folders to exclude.
Task
- Create a
.dockerignore
file in the project's root directory. - Add the
venv
folder to the.dockerignore
file.
Obrigado pelo seu feedback!