optimised Dockerfile to reduce layer count and group common operations