-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile-sqlite
39 lines (28 loc) · 1.62 KB
/
Dockerfile-sqlite
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build-env
WORKDIR /app
COPY . ./
RUN sed -i 's#<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="5.0.0" />#<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="5.0.0" />#' src/SimplCommerce.WebHost/SimplCommerce.WebHost.csproj
RUN sed -i 's/UseSqlServer/UseSqlite/' src/SimplCommerce.WebHost/Program.cs
RUN sed -i 's/UseSqlServer/UseSqlite/' src/SimplCommerce.WebHost/Extensions/ServiceCollectionExtensions.cs
RUN sed -i 's/"DefaultConnection": ".*"/"DefaultConnection": "Data Source=simplcommerce.db"/' src/SimplCommerce.WebHost/appsettings.json
RUN rm src/SimplCommerce.WebHost/Migrations/*
RUN dotnet tool install --global dotnet-ef --version 5.0.0
ENV PATH="${PATH}:/root/.dotnet/tools"
# ef core migrations run in debug, so we have to build in Debug for copying module correctly
RUN dotnet restore && dotnet build \
&& cd src/SimplCommerce.WebHost \
&& dotnet ef migrations add initialSchema \
&& dotnet ef database update
RUN dotnet build -c Release \
&& cd src/SimplCommerce.WebHost \
&& dotnet build -c Release \
&& dotnet publish -c Release -o out
RUN curl -SL "https://github.com/rdvojmoc/DinkToPdf/raw/v1.0.8/v0.12.4/64%20bit/libwkhtmltox.so" --output /app/src/SimplCommerce.WebHost/out/libwkhtmltox.so
FROM mcr.microsoft.com/dotnet/aspnet:5.0
RUN apt-get update \
&& apt-get install libgdiplus -y \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
COPY --from=build-env /app/src/SimplCommerce.WebHost/out ./
COPY --from=build-env /app/src/SimplCommerce.WebHost/simplcommerce.db ./
ENTRYPOINT ["dotnet", "SimplCommerce.WebHost.dll"]