-ENV POLICY_HOME /opt/app/policy
-ENV POLICY_LOGS ${POLICY_LOGS}
-
-# Create DMaaP simulator user and group
-# Add simulator-specific directories and set ownership as the simulator user
-RUN mkdir -p ${POLICY_HOME}/simulators \
- && mkdir -p ${POLICY_HOME}/simulators/bin \
- && mkdir -p ${POLICY_LOGS} \
- && mkdir /packages
-
-# Unpack the tarball
-COPY /maven/* /packages
-RUN tar xvfz /packages/models-simulator.tar.gz --directory ${POLICY_HOME}/simulators \
- && rm /packages/models-simulator.tar.gz
-
-# Ensure everything has the correct permissions
-# Copy scripts simulator user area
-COPY simulators.sh ${POLICY_HOME}/simulators/bin
-RUN find /opt/app -type d -perm 755 \
- && find /opt/app -type f -perm 644 \
- && chmod 755 ${POLICY_HOME}/simulators/bin/* \
- && chown -R policy:policy $POLICY_HOME $POLICY_LOGS
-
-USER policy:policy
-
-ENV PATH ${POLICY_HOME}/simulators/bin:$PATH
-ENTRYPOINT [ "simulators.sh" ]
+ENV POLICY_LOGS=$POLICY_LOGS
+ENV POLICY_HOME=$POLICY_HOME/simulators
+
+USER root
+RUN mkdir -p $POLICY_HOME $POLICY_LOGS && \
+ chown -R policy:policy $POLICY_HOME $POLICY_LOGS
+
+COPY --chown=policy:policy --from=tarball /extracted $POLICY_HOME
+
+WORKDIR $POLICY_HOME
+COPY --chown=policy:policy simulators.sh bin/
+
+RUN chmod 755 bin/*.sh
+
+USER policy
+WORKDIR $POLICY_HOME/bin
+ENTRYPOINT [ "./simulators.sh" ]