Improve Azure function docker file with dotnet watch option

Viewed 43

I am coming with the following docker file for the dev enviornment. I am doing mount binding in docker-compose file to perform dotnet watch following this.

I am worried if I can improve this further may be using some official images.

Dockerfile

FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build

RUN apt-get update \
    && apt-get -y install curl gnupg \
    && curl -fsSL https://deb.nodesource.com/setup_16.x | bash - \
    && apt-get -y install nodejs \
    && npm i -g azure-functions-core-tools@4 --unsafe-perm true \
    && apt-get install -y unzip \
    && curl -sSL https://aka.ms/getvsdbgsh | /bin/sh /dev/stdin -v latest -l ~/vsdbg \
    && apt-get install -y tini \
    && rm -rf /varc/cache/apt

WORKDIR /src
COPY "Project.csproj" .
RUN dotnet restore

ENTRYPOINT ["/usr/bin/tini","--"]

# Why not use this image instead of manual?
# FROM mcr.microsoft.com/azure-functions/dotnet-isolated:4-dotnet-isolated6.0-appservice

ENV AzureWebJobsScriptRoot=/home/site/wwwroot \
     AzureFunctionsJobHost__Logging__Console__IsEnabled=true
0 Answers
Related