Skip to content

Commit

Permalink
Add GbxExplorerOld Dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
BigBang1112 committed May 25, 2024
1 parent 18b3a59 commit 91d5e42
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
**/.classpath
**/.dockerignore
**/.env
**/.git
# **/.git
**/.gitignore
**/.project
**/.settings
Expand Down
4 changes: 4 additions & 0 deletions Tools/GbxExplorer/Server/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ COPY Tools/GbxExplorer/Component/*.csproj Tools/GbxExplorer/Component/
COPY Tools/GbxExplorer/Shared/*.csproj Tools/GbxExplorer/Shared/
COPY Src/GBX.NET/*.csproj Src/GBX.NET/
COPY Src/GBX.NET.LZO/*.csproj Src/GBX.NET.LZO/
COPY Src/GBX.NET.Hashing/*.csproj Src/GBX.NET.Hashing/
COPY Src/GBX.NET.ZLib/*.csproj Src/GBX.NET.ZLib/
COPY Src/GBX.NET.Lua/*.csproj Src/GBX.NET.Lua/
COPY Generators/GBX.NET.Generators/*.csproj Generators/GBX.NET.Generators/
RUN dotnet restore Tools/GbxExplorer/Server/GbxExplorer.Server.csproj -a $TARGETARCH
Expand All @@ -21,6 +23,8 @@ COPY Tools/GbxExplorer/Component/ Tools/GbxExplorer/Component/
COPY Tools/GbxExplorer/Shared/ Tools/GbxExplorer/Shared/
COPY Src/GBX.NET/ Src/GBX.NET/
COPY Src/GBX.NET.LZO/ Src/GBX.NET.LZO/
COPY Src/GBX.NET.Hashing/ Src/GBX.NET.Hashing/
COPY Src/GBX.NET.ZLib/ Src/GBX.NET.ZLib/
COPY Src/GBX.NET.Lua/ Src/GBX.NET.Lua/
COPY Generators/GBX.NET.Generators/ Generators/GBX.NET.Generators/
COPY Resources/ Resources/
Expand Down
40 changes: 40 additions & 0 deletions Tools/GbxExplorerOld/Server/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:8.0-alpine AS build
ARG BUILD_CONFIGURATION=Release
ARG TARGETARCH=x64
RUN apk add --no-cache git
WORKDIR /src

COPY .git/ ./.git/

# RUN dotnet workload install wasm-tools

# copy csproj and restore as distinct layers
COPY Tools/GbxExplorerOld/Server/*.csproj Tools/GbxExplorerOld/Server/
COPY Tools/GbxExplorerOld/Client/*.csproj Tools/GbxExplorerOld/Client/
COPY Src/GBX.NET/*.csproj Src/GBX.NET/
COPY Src/GBX.NET.LZO/*.csproj Src/GBX.NET.LZO/
COPY Src/GBX.NET.Hashing/*.csproj Src/GBX.NET.Hashing/
COPY Src/GBX.NET.ZLib/*.csproj Src/GBX.NET.ZLib/
COPY Generators/GBX.NET.Generators/*.csproj Generators/GBX.NET.Generators/
RUN dotnet restore Tools/GbxExplorerOld/Server/GbxExplorerOld.Server.csproj -a $TARGETARCH

# copy and publish app and libraries
COPY Tools/GbxExplorerOld/Server/ Tools/GbxExplorerOld/Server/
COPY Tools/GbxExplorerOld/Client/ Tools/GbxExplorerOld/Client/
COPY Src/GBX.NET/ Src/GBX.NET/
COPY Src/GBX.NET.LZO/ Src/GBX.NET.LZO/
COPY Src/GBX.NET.Hashing/ Src/GBX.NET.Hashing/
COPY Src/GBX.NET.ZLib/ Src/GBX.NET.ZLib/
COPY Generators/GBX.NET.Generators/ Generators/GBX.NET.Generators/
COPY Resources/ Resources/
RUN dotnet publish Tools/GbxExplorerOld/Server -c $BUILD_CONFIGURATION -a $TARGETARCH -o /app --no-restore


# final stage/image
FROM mcr.microsoft.com/dotnet/aspnet:8.0-alpine
EXPOSE 8080
EXPOSE 8081
WORKDIR /app
COPY --from=build /app .
USER $APP_UID
ENTRYPOINT ["./GbxExplorerOld.Server"]
2 changes: 0 additions & 2 deletions Tools/GbxExplorerOld/Server/GbxExplorerOld.Server.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
<UserSecretsId>14bef366-38a3-418f-93d8-e19bd6a41e2a</UserSecretsId>
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
<DockerfileContext>..\..\..</DockerfileContext>
<PublishReadyToRun>true</PublishReadyToRun>
<SelfContained>true</SelfContained>
<InvariantGlobalization>true</InvariantGlobalization>
</PropertyGroup>

Expand Down

0 comments on commit 91d5e42

Please sign in to comment.