-
Notifications
You must be signed in to change notification settings - Fork 15
/
Dockerfile.amd64
55 lines (48 loc) · 2.82 KB
/
Dockerfile.amd64
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build-env
WORKDIR /app
ARG COMMIT
# Copy csproj and restore as distinct layers
COPY ./NineChronicles.Headless/Lib9c/Lib9c/Lib9c.csproj ./NineChronicles.Headless/Lib9c/Lib9c/
COPY ./NineChronicles.Headless/Libplanet.Headless/Libplanet.Headless.csproj ./NineChronicles.Headless/Libplanet.Headless/
COPY ./NineChronicles.Headless/NineChronicles.RPC.Shared/NineChronicles.RPC.Shared/NineChronicles.RPC.Shared.csproj ./NineChronicles.Headless/NineChronicles.RPC.Shared/NineChronicles.RPC.Shared/
COPY ./NineChronicles.Headless/NineChronicles.Headless/NineChronicles.Headless.csproj ./NineChronicles.Headless/NineChronicles.Headless/
COPY ./NineChronicles.Headless/NineChronicles.Headless.Executable/NineChronicles.Headless.Executable.csproj ./NineChronicles.Headless/NineChronicles.Headless.Executable/
COPY ./NineChronicles.DataProvider/NineChronicles.DataProvider.csproj ./NineChronicles.DataProvider/
COPY ./NineChronicles.DataProvider.Executable/NineChronicles.DataProvider.Executable.csproj ./NineChronicles.DataProvider.Executable/
RUN dotnet restore NineChronicles.Headless/Lib9c/Lib9c
RUN dotnet restore NineChronicles.Headless/Libplanet.Headless
RUN dotnet restore NineChronicles.Headless/NineChronicles.RPC.Shared/NineChronicles.RPC.Shared
RUN dotnet restore NineChronicles.Headless/NineChronicles.Headless
RUN dotnet restore NineChronicles.Headless/NineChronicles.Headless.Executable
RUN dotnet restore NineChronicles.DataProvider
RUN dotnet restore NineChronicles.DataProvider.Executable
# Copy everything else and build
COPY . ./
RUN dotnet publish NineChronicles.DataProvider.Executable/NineChronicles.DataProvider.Executable.csproj \
-c Release \
-r linux-x64 \
-o out \
--self-contained \
--version-suffix $COMMIT
RUN dotnet publish NineChronicles.Headless/NineChronicles.Headless.Executable/NineChronicles.Headless.Executable.csproj \
-c Release \
-r linux-x64 \
-o out2 \
--self-contained \
--version-suffix $COMMIT
# Build runtime image
FROM --platform=linux/amd64 mcr.microsoft.com/dotnet/sdk:8.0-bookworm-slim
WORKDIR /app
RUN dotnet tool install --global dotnet-ef --version 7.0.14
ENV PATH="${PATH}:/${HOME}/.dotnet/tools"
COPY --from=build-env /app/out .
COPY --from=build-env /app/out2 NineChronicles.Headless.Executable
COPY ./NineChronicles.DataProvider ./NineChronicles.DataProvider/NineChronicles.DataProvider/
COPY ./NineChronicles.DataProvider.Executable ./NineChronicles.DataProvider/NineChronicles.DataProvider.Executable/
COPY ./NineChronicles.Headless ./NineChronicles.DataProvider/NineChronicles.Headless/
RUN apt-get update \
&& apt-get install -y --allow-unauthenticated \
libc6-dev liblz4-dev zlib1g-dev libsnappy-dev libzstd-dev jq curl \
&& rm -rf /var/lib/apt/lists/*
VOLUME /data
ENTRYPOINT ["dotnet", "NineChronicles.DataProvider.Executable.dll"]