-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathDockerfile
More file actions
79 lines (68 loc) · 3.11 KB
/
Copy pathDockerfile
File metadata and controls
79 lines (68 loc) · 3.11 KB
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#
# Build stage/image
#
FROM mcr.microsoft.com/dotnet/sdk:10.0 AS build
WORKDIR /app
COPY *.props .
# Copy csproj and restore as distinct layers
COPY ["src/Host/*.csproj", "src/Host/"]
COPY ["src/Host/*.targets", "src/Host/"]
COPY ["src/Application/*.csproj", "src/Application/"]
COPY ["src/Persistence/Persistence.InMemory/*.csproj", "src/Persistence/Persistence.InMemory/"]
COPY ["src/Persistence/Persistence.MariaDB/*.csproj", "src/Persistence/Persistence.MariaDB/"]
COPY ["src/Persistence/Persistence.SQLite/*.csproj", "src/Persistence/Persistence.SQLite/"]
COPY ["src/Persistence/*.props", "src/Persistence/"]
COPY ["external/SampSharp/Directory.Build.props", "external/SampSharp/"]
COPY ["external/SampSharp/Directory.Packages.props", "external/SampSharp/"]
COPY ["external/SampSharp/src/SampSharp.OpenMp.Core/*.csproj", "external/SampSharp/src/SampSharp.OpenMp.Core/"]
COPY ["external/SampSharp/src/SampSharp.OpenMp.Entities/*.csproj", "external/SampSharp/src/SampSharp.OpenMp.Entities/"]
COPY ["external/SampSharp/src/SampSharp.OpenMp.Entities.Commands/*.csproj", "external/SampSharp/src/SampSharp.OpenMp.Entities.Commands/"]
COPY ["external/SampSharp/src/SampSharp.SourceGenerator/*.csproj", "external/SampSharp/src/SampSharp.SourceGenerator/"]
COPY ["external/SampSharp/src/SampSharp.Analyzer/*.csproj", "external/SampSharp/src/SampSharp.Analyzer/"]
COPY ["external/SampSharp/src/SampSharp.CodeFixes/*.csproj", "external/SampSharp/src/SampSharp.CodeFixes/"]
WORKDIR /app/src/Host
RUN dotnet restore
# Copy everything else and build
COPY ["src/", "/app/src/"]
COPY ["external/", "/app/external/"]
RUN dotnet publish -c Release -o /app/out --no-restore
#
# Prepare open.mp server and components
#
FROM ubuntu:22.04 AS tools
RUN apt-get update && apt-get install -y --no-install-recommends wget xz-utils
WORKDIR /open-mp
ENV OPENMP_VERSION="1.5.8.3079"
RUN wget https://github.com/SampSharp/openmultiplayer-x64-builds/releases/download/v${OPENMP_VERSION}/open.mp-linux-x86_64-dynssl-v${OPENMP_VERSION}.tar.xz --no-check-certificate \
&& tar -xf open.mp-linux-x86_64-dynssl-v${OPENMP_VERSION}.tar.xz \
&& rm -f open.mp-linux-x86_64-dynssl-v${OPENMP_VERSION}.tar.xz
# Download prebuilt SampSharp + Streamer component bundle.
# Contents:
# - SampSharp.so
# - SampSharp.Streamer.so
# - streamer.so
ENV COMPONENT_BUNDLE_VERSION="2026.1"
RUN wget https://github.com/DevD4v3/SampSharp/releases/download/v${COMPONENT_BUNDLE_VERSION}/components-linux.tar.xz --no-check-certificate \
&& tar -xJf components-linux.tar.xz -C Server/components \
&& rm -f components-linux.tar.xz
#
# Final stage/image
#
FROM mcr.microsoft.com/dotnet/runtime:10.0
WORKDIR /app
RUN apt-get update && apt-get install -y --no-install-recommends \
openssl \
libstdc++6 \
libatomic1 \
jq \
tzdata \
&& rm -rf /var/lib/apt/lists/*
COPY --from=tools /open-mp/Server .
COPY --from=build /app/out gamemode
COPY ["gamemodes/*.amx", "gamemodes/"]
COPY ["filterscripts/*.amx", "filterscripts/"]
COPY ["codepages/*.txt", "codepages/"]
COPY ["config.json", "config.json"]
COPY ["entrypoint.sh", "entrypoint.sh"]
RUN chmod +x entrypoint.sh
ENTRYPOINT ["./entrypoint.sh"]