Optimize docker build to reduce number of layers