diff --git a/server/Dockerfile b/server/Dockerfile index 486d0a4..b03a2ba 100644 --- a/server/Dockerfile +++ b/server/Dockerfile @@ -1,29 +1,35 @@ -FROM microsoft/dotnet:2.1-sdk as build-env -# FROM microsoft/aspnetcore-build:2.1.300-preview2-stretch AS build-env +FROM microsoft/dotnet:2.1-sdk-alpine AS build WORKDIR /app -# Copy csproj and restore as distinct layers -COPY *.csproj ./ -COPY NuGet.config ./ +# copy csproj and restore as distinct layers +COPY *.csproj . RUN dotnet restore \ --source https://api.nuget.org/v3/index.json \ --source https://dotnet.myget.org/F/aspnetcore-dev/api/v3/index.json \ --source https://dotnet.myget.org/F/aspnetcore-ci-dev/api/v3/index.json \ - --source https://www.myget.org/F/sixlabors/api/v3/index.json + --source https://www.myget.org/F/sixlabors/api/v3/index.json -# Copy everything else and build -COPY . ./ +# copy everything else and build app +COPY . . +WORKDIR /app/ +RUN dotnet build + +FROM build AS publish +WORKDIR /app RUN dotnet publish -c Release -o out -# Build runtime image -FROM microsoft/dotnet:2.1-aspnetcore-runtime -WORKDIR /app -COPY --from=build-env /app/out . -RUN apt-get update && apt-get install -y \ +FROM microsoft/dotnet:2.1-aspnetcore-runtime-alpine AS runtime +WORKDIR /app +COPY --from=publish /app/out ./ +# ln -s /usr/lib/libuv.so.1 /usr/lib/libuv.so && \ + +RUN apk add --no-cache --update \ python \ ffmpeg \ - curl && \ + libuv \ + curl \ + curl-dev && \ curl -L https://yt-dl.org/downloads/latest/youtube-dl -o /usr/local/bin/youtube-dl && \ chmod a+rx /usr/local/bin/youtube-dl && \ youtube-dl -U diff --git a/server/Dockerfile.alpine b/server/Dockerfile.alpine deleted file mode 100644 index 01e123c..0000000 --- a/server/Dockerfile.alpine +++ /dev/null @@ -1,37 +0,0 @@ -FROM microsoft/dotnet:2.1.300-preview2-sdk-alpine AS build -WORKDIR /app - -# copy csproj and restore as distinct layers -COPY *.csproj . -RUN dotnet restore \ - --source https://api.nuget.org/v3/index.json \ - --source https://dotnet.myget.org/F/aspnetcore-dev/api/v3/index.json \ - --source https://dotnet.myget.org/F/aspnetcore-ci-dev/api/v3/index.json \ - --source https://www.myget.org/F/sixlabors/api/v3/index.json - -# copy everything else and build app -COPY . . -WORKDIR /app/ -RUN dotnet build - -FROM build AS publish -WORKDIR /app -RUN dotnet publish -c Release -o out - - -FROM microsoft/dotnet:2.1.0-preview2-aspnetcore-runtime-alpine AS runtime -WORKDIR /app -COPY --from=publish /app/out ./ -# ln -s /usr/lib/libuv.so.1 /usr/lib/libuv.so && \ - -RUN apk add --no-cache --update \ - python \ - ffmpeg \ - libuv \ - curl \ - curl-dev && \ - curl -L https://yt-dl.org/downloads/latest/youtube-dl -o /usr/local/bin/youtube-dl && \ - chmod a+rx /usr/local/bin/youtube-dl && \ - youtube-dl -U - -ENTRYPOINT ["dotnet", "PodNoms.Api.dll"] diff --git a/server/PodNoms.Api.csproj b/server/PodNoms.Api.csproj index 5e23e71..52b95ee 100644 --- a/server/PodNoms.Api.csproj +++ b/server/PodNoms.Api.csproj @@ -19,7 +19,7 @@ - + @@ -31,7 +31,7 @@ - +