diff --git a/opensim-standalone/Dockerfile-standalone b/opensim-standalone/Dockerfile-standalone index 9a5a531..18359fd 100644 --- a/opensim-standalone/Dockerfile-standalone +++ b/opensim-standalone/Dockerfile-standalone @@ -20,53 +20,46 @@ RUN apt-get update \ sqlite \ && rm -rf /var/lib/apt/lists/* -# Scripts that keep OpenSimulator running, make crash reports, clean up log files, etc -COPY scripts/* /home/opensim/ -COPY vimrc /home/opensim/.vimrc +# The simulator is run under the user name 'opensim' +# (From https://stackoverflow.com/questions/27701930/add-user-to-docker-container) +RUN adduser --disabled-password --gecos 'OpenSimulator user' opensim -# Fetch the latest version of the OpenSimulator sources. +USER opensim:opensim + +# Scripts that keep OpenSimulator running, make crash reports, clean up log files, etc +COPY --chown=opensim:opensim scripts/* /home/opensim/ +COPY --chown=opensim:opensim vimrc /home/opensim/.vimrc + +# Fetch and build the latest version of the OpenSimulator sources. +# THis includes a lot of steps so we can delete the sources and git files +# to make the resulting layer small. RUN cd /home/opensim \ && git clone git://opensimulator.org/git/opensim \ - && cp $OPENSIMDIR/bin/OpenSim.ini.example $OPENSIMDIR/bin/OpenSim.ini + && rm -rf $OPENSIMDIR/.git \ + && cd $OPENSIMDIR \ + && ./runprebuild.sh \ + && msbuild \ + && cd $OPENSIMDIR \ + && rm -rf OpenSim # OpenSim.ini does an include of "config-include/Standalone.ini". # so copy an empty version to nullfy the default configuration. -COPY config-include/ $OPENSIMDIR/bin/config-include/ +COPY --chown=opensim:opensim config-include/ $OPENSIMDIR/bin/config-include/ # Copy over any extra configuration files we're including RUN mkdir -p $OPENSIMDIR/bin/config -COPY config/ $OPENSIMDIR/bin/config/ +COPY --chown=opensim:opensim config/ $OPENSIMDIR/bin/config/ +# Use the default, included configuration parameters +RUN cp $OPENSIMDIR/bin/OpenSim.ini.example $OPENSIMDIR/bin/OpenSim.ini # Build OpenSimulator RUN cd $OPENSIMDIR \ && ./runprebuild.sh \ && msbuild -# ============================================================================ -# 'slim' doesn't run OpenSimulator so it can't be used -# FROM mono:5-slim -FROM mono:5 +# Remove sources that are not needed for running +RUN cd $OPENSIMDIR \ + && rm -rf OpenSim -ENV OPENSIMDIR=/home/opensim/opensim - -# Include required packages ('coreutils git vim' included for debugging) -RUN apt-get update \ - && apt-get install -y \ - coreutils git vim \ - procps \ - screen \ - ccrypt \ - cron \ - mysql-client \ - sqlite \ - && rm -rf /var/lib/apt/lists/* - -# The simulator is run under the user name 'opensim' -# (From https://stackoverflow.com/questions/27701930/add-user-to-docker-container) -RUN adduser --disabled-password --gecos 'OpenSimulator user' opensim - -COPY --from=built --chown=opensim:opensim /home/opensim/ /home/opensim - -USER opensim:opensim WORKDIR $OPENSIMDIR/bin ENTRYPOINT [ "/home/opensim/bootOpenSim.sh" ]