Azure / Azure/azure-cli

Az acr build parses all files in repo even if excluded in .dockerignore

Open
#31,250 16 comments 2 reactions 4 assignees Claimed by @northtyphoon View on GitHub
act-observability-squad Auto-Assign bug Container Registry customer-reported Possible-Solution Service Attention Similar-Issue
Dominant language
Python
Stars
4.6k
Forks
3.5k
Avg merge
3d 2h
Merged PRs (30d)
60

Description

### Describe the bug

I am trying to build a docker image with `az acr build -t -f Dockerfile -r .` and I have a `.dockerignore` file with `.venv` in it. However `az acr build` parses all files within the dockerignore file, and it is very slow. It just does not ignore the folder, but parses every file within ignored folders. I don't think this should happen

### Related command

`az acr build -t -f Dockerfile -r .`

### Errors

After more than 30min, I get an error:
```
Packing source code into tar to upload...
[Errno 2] No such file or directory: '.\\.venv\\bin\\python3.12'
```

### Issue script & Debug output

Long logs of the form `cli.azure.cli.command_modules.acr._archive_utils: .dockerignore: no rule for '.venv/lib/python3.12/site-packages/pyright/dist/dist/typeshed-fallback/stubs/TgCrypto'. parent ignore 'True'`

### Expected behavior

Running az acr build should be fast even if I am using a virtual environment

### Environment Summary

azure-cli 2.71.0 core 2.71.0
telemetry 1.1.0 Extensions:
bastion 1.4.0
ssh 2.0.6 Dependencies:
msal 1.31.2b1
azure-mgmt-resource 23.1.1 Python location 'C:\Program Files\Microsoft SDKs\Azure\CLI2\python.exe'
Config directory 'C:\Users\javierzazo\.azure'
Extensions directory 'C:\Users\javierzazo\.azure\cliextensions' Python (Windows) 3.12.8 (tags/v3.12.8:2dc476b, Dec 3 2024, 19:30:04) [MSC v.1942 64 bit (AMD64)]

Legal docs and information: aka.ms/AzureCliLegal

Your CLI is up-to-date.

### Additional context

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.