Alpine image working

This commit is contained in:
Fergal Moran
2018-05-09 10:04:24 +01:00
parent 4727cba5e2
commit 262b4b4f8d
3 changed files with 22 additions and 53 deletions

View File

@@ -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
# 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

View File

@@ -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"]

View File

@@ -19,7 +19,7 @@
<PackageReference Include="Hangfire" Version="1.6.17" />
<PackageReference Include="Hangfire.MemoryStorage" Version="1.5.2" />
<PackageReference Include="Lib.Net.Http.WebPush" Version="1.3.0" />
<PackageReference Include="Microsoft.AspNetCore.App" Version="2.1.0-preview2-final" />
<PackageReference Include="Microsoft.AspNetCore.App" Version="2.1.0-rc1-final" />
<PackageReference Include="AutoMapper" Version="6.2.2" />
<PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="3.2.0" />
<PackageReference Include="Handlebars.NetStandard" Version="1.8.1" />
@@ -31,7 +31,7 @@
<PackageReference Include="SixLabors.ImageSharp" Version="1.0.0-dev001179" />
<PackageReference Include="SQLitePCLRaw.bundle_green" Version="1.1.10-pre20180223200113" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="2.3.0" />
<PackageReference Include="System.Text.Encoding.CodePages" Version="4.5.0-preview2-26406-04" />
<PackageReference Include="System.Text.Encoding.CodePages" Version="4.5.0-rc1" />
<PackageReference Include="WindowsAzure.Storage" Version="8.2.1" />
</ItemGroup>
<ItemGroup>