anchor.diff:  # install ruby for simulator
   RUN apt-get update && apt-get install -y ruby
   
  +# change to a new non-root user for better security.
  +# this also adds the user to a group with the same name.
  +# --create-home creates a home folder, ie /home/<username>
  +RUN useradd --create-home agent
  +USER agent
  +
  +# install agent executable
  +COPY --chown=agent:agent --from=build /root/agent/build/bin/agent /usr/local/bin/
  +
  +# copy data to /etc/mtconnect
  +COPY --chown=agent:agent --from=build /root/agent/schemas /etc/mtconnect/schemas
  +COPY --chown=agent:agent --from=build /root/agent/simulator /etc/mtconnect/simulator
  +COPY --chown=agent:agent --from=build /root/agent/styles /etc/mtconnect/styles
  +
   # expose port
   EXPOSE 5000
   
  -# install agent executable
  -COPY --from=build /root/agent/build/bin/agent /usr/local/bin/
  -# RUN chmod +x /user/local/bin/agent
  -
  -# copy data to /etc/mtconnect
  -COPY --from=build /root/agent/schemas /etc/mtconnect/
  -COPY --from=build /root/agent/simulator /etc/mtconnect/
  -COPY --from=build /root/agent/styles /etc/mtconnect/
  -
  -WORKDIR /etc/mtconnect
  +WORKDIR /home/agent
   
   # default command - can override with docker run or docker-compose command.
   # this runs the adapter simulator and the agent using the sample config file.
  
positive.code: # so can clone the private mtconnect cppagent_dev repo.
  # keep it out of the github repo with .gitignore.
  # this sets up a file with the contents accessible at /run/secrete/access_token.
  # see below at 
  #   git clone https://$(cat /run/secrets/access_token)@github.com...
  
  # ---------------------------------------------------------------------
  # os
  
negative.code:   -o run_tests=False \
    -o with_ruby=$WITH_RUBY
  
  # limit cpus so don't run out of memory on local machine
  # symptom: get error - "c++: fatal error: Killed signal terminated program cc1plus"
  ENV CONAN_CPU_COUNT=1
  
  # compile source (~20mins - 3hrs for qemu)
  RUN cd ~/agent && conan build . -bf build
  
  # ---------------------------------------------------------------------
  # release
  