openairplay / airplay2-receiver

AirPlay 2 Receiver - Python implementation
2.12k stars 131 forks source link

Dockerfile best practice: COPY source code after pip install #68

Closed m3brown closed 2 years ago

m3brown commented 2 years ago

Due to have docker containers increment container changes in layers, the best practice in the community is to load source code files AFTER installing third party dependencies (i.e. pip install).

In the current config, any time a change is made to ap2-receiver.py or any files in the ap2 directory, docker is prompted to rerun the pip install command, which is slow and bandwidth intensive.

With the proposed changes in this PR, after the initial build, pip install will only run if the requirements.py has changed.