Skip to content

Commit

Permalink
Add diagnostic tools to container image to avoid needing to copy them…
Browse files Browse the repository at this point in the history
… in (#1344)
  • Loading branch information
karashiiro authored Jul 22, 2024
1 parent c2aa639 commit f251498
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 5 deletions.
38 changes: 33 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,42 @@ RUN ./build.sh --target Test Compile --configuration Release
# Run stage
FROM mcr.microsoft.com/dotnet/aspnet:7.0

# Install dependencies
WORKDIR /
RUN apt update && apt install curl git zsh -y
RUN sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
ENV ZSH_THEME=clean

# Install .NET diagnostic tools
WORKDIR /usr/bin
RUN \
# dotnet-trace allows for profiling the application in a running container
# > dotnet-trace collect -p1 --duration '00:00:00:30'
curl -L --output dotnet-trace https://aka.ms/dotnet-trace/linux-x64 && \
chmod +x dotnet-trace && \
# dotnet-gcdump allows for collecting heap dumps, but usually results in the container going OOM
# > dotnet-gcdump collect -p1
curl -L --output dotnet-gcdump https://aka.ms/dotnet-gcdump/linux-x64 && \
chmod +x dotnet-gcdump && \
# Ensure each of the files has a non-zero size
test -s dotnet-trace && \
test -s dotnet-gcdump || \
# Fail this step if any check failed
exit 1

# Download sheets
WORKDIR /sqpack/ffxiv
RUN apt update && apt install curl -y
RUN curl -O https://raw.githubusercontent.com/karashiiro/0a0000/main/0a0000.win32.dat0
RUN curl -O https://raw.githubusercontent.com/karashiiro/0a0000/main/0a0000.win32.index2
RUN curl -O https://raw.githubusercontent.com/karashiiro/0a0000/main/0a0000.win32.index
RUN \
# Fetch game data from repo
curl -OL https://raw.githubusercontent.com/karashiiro/0a0000/main/0a0000.win32.{dat0,index2,index} && \
# Ensure each of the files has a non-zero size, otherwise game data is corrupt for some reason
test -s 0a0000.win32.dat0 && \
test -s 0a0000.win32.index2 && \
test -s 0a0000.win32.index || \
# Fail this step if any check failed
exit 1

WORKDIR /app
COPY --from=build-env /source/artifacts/ ./
HEALTHCHECK --start-period=45s --interval=15s --retries=3 --timeout=5s CMD curl -sf http://localhost:4002/api/74/5 || exit 1
HEALTHCHECK --start-period=60s --interval=180s --retries=3 --timeout=30s CMD curl -sf http://localhost:4002/api/74/5 || exit 1
ENTRYPOINT ["dotnet", "Universalis.Application.dll"]
1 change: 1 addition & 0 deletions src/Universalis.sln
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
.editorconfig = .editorconfig
..\.gitignore = ..\.gitignore
..\Dockerfile = ..\Dockerfile
..\.gitattributes = ..\.gitattributes
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Deployment", "Deployment", "{8BB061B0-B276-4B4E-B102-11DF81A5FB64}"
Expand Down

0 comments on commit f251498

Please sign in to comment.