FROM microsoft/dotnet:2.1-sdk AS builder ARG WEBAPI_PROJECT=WebApi ARG BUILD_CONFIG=Release ARG CONFIG_DIR=/etc/default/config-files/ COPY ./SiteStatus/ /tmp/backend/ RUN echo "Building ${WEBAPI_PROJECT} in ${BUILD_CONFIG} configuration" && \ mkdir "${CONFIG_DIR}" &&\ cd /tmp/backend/ && \ dotnet restore && \ mkdir /var/www && \ cd /tmp/backend/${WEBAPI_PROJECT} && \ dotnet publish --configuration "${BUILD_CONFIG}" --output /var/www && \ cp /tmp/backend/${WEBAPI_PROJECT}/appsettings.* "${CONFIG_DIR}" && \ ln -s /var/www/${WEBAPI_PROJECT}.dll /var/www/__RUN_ME.DLL FROM microsoft/dotnet:2.1-aspnetcore-runtime ARG CONFIG_DIR=/etc/default/config-files/ RUN rm -rf /var/log/* && \ mkdir "${CONFIG_DIR}" COPY ./vars-vars /etc/vars-vars COPY ./vars-files /etc/vars-files COPY ./run.sh /run.sh COPY --from=builder "${CONFIG_DIR}" "${CONFIG_DIR}" COPY --from=builder /var/www /var/www EXPOSE 80 VOLUME ["/data/storage"] CMD ["/run.sh"]