forked from LittleBigRefresh/Refresh
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
41 lines (30 loc) · 1.05 KB
/
Dockerfile
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
# Build stage
FROM mcr.microsoft.com/dotnet/sdk:8.0.203-bookworm-slim AS build
WORKDIR /build
COPY *.sln ./
COPY **/*.csproj ./
RUN dotnet sln list | grep ".csproj" \
| while read -r line; do \
mkdir -p $(dirname $line); \
mv $(basename $line) $(dirname $line); \
done;
RUN dotnet restore --use-current-runtime
COPY . .
RUN dotnet publish Refresh.GameServer -c Release --property:OutputPath=/build/publish/ --no-restore --no-self-contained
# Final running container
FROM mcr.microsoft.com/dotnet/runtime:8.0.3-bookworm-slim AS final
# Add non-root user
RUN set -eux && \
apt update && \
apt install -y gosu && \
rm -rf /var/lib/apt/lists/* && \
gosu nobody true && \
groupadd -g 1001 refresh && \
useradd -m --home /refresh -u 1001 -g refresh refresh &&\
mkdir -p /refresh/data && \
mkdir -p /refresh/app
COPY --from=build /build/publish/publish /refresh/app
COPY --from=build /build/scripts/docker-entrypoint.sh /refresh
RUN chown -R refresh:refresh /refresh && \
chmod +x /refresh/docker-entrypoint.sh
ENTRYPOINT ["/refresh/docker-entrypoint.sh"]