ARG COREVERS=3.1 FROM mcr.microsoft.com/dotnet/sdk:$COREVERS AS build ARG TZ=Europe/London ARG USE_SEQ=0 WORKDIR /App COPY res/id_rsa /root/.ssh/ RUN touch /root/.ssh/known_hosts RUN apt-get update && DEBIAN_FRONTEND="noninteractive" apt-get install -y openssh-client RUN ssh-keyscan -T 60 bitbucket.org >> /root/.ssh/known_hosts RUN chmod 600 /root/.ssh/* COPY res/appsettings.sh . COPY res/nuget.config . ADD res/nuget.tgz / RUN ln -sf /usr/share/zoneinfo/$TZ /etc/localtime \ && echo $TZ > /etc/timezone ARG PROJ ARG DIR ARG BRANCH RUN git clone git@bitbucket.org:globalprocessing/$PROJ.git --single-branch --branch $BRANCH WORKDIR /App/$PROJ/$DIR RUN /bin/bash /App/appsettings.sh RUN dotnet restore RUN dotnet publish -c Release -o /App/out RUN echo "dotnet `basename $DIR`.dll \$@" > /App/out/start.sh FROM mcr.microsoft.com/dotnet/aspnet:$COREVERS WORKDIR /App COPY --from=build /App/out . COPY --from=build /etc/timezone /etc/localtime /etc/ ENTRYPOINT ["sh", "start.sh"]