From f46a595008682eedfbc78357af50bf02f5bb73ba Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Mon, 28 Oct 2024 20:23:25 +0900 Subject: [PATCH] Improve Dockerfile --- Dockerfile | 23 ++++++++++++++++------- External/.dockerignore | 0 SDL3-CS/generate_bindings.sh | 10 +++++----- 3 files changed, 21 insertions(+), 12 deletions(-) create mode 100644 External/.dockerignore diff --git a/Dockerfile b/Dockerfile index 62e25d1..a3103eb 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,11 +1,20 @@ FROM ubuntu:24.04 -RUN apt-get update && apt-get install -y \ - dotnet-sdk-8.0 \ - python3 \ - git \ - build-essential +RUN apt-get update && \ + apt-get install -y dotnet-sdk-8.0 python3 git build-essential && \ + ln -s /usr/bin/python3 /usr/bin/python -RUN ln -s /usr/bin/python3 /usr/bin/python +WORKDIR /app +COPY . . +RUN dotnet tool restore && \ + dotnet restore --ucr SDL3-CS/SDL3-CS.csproj && \ + rm -r /app -SHELL ["/bin/bash", "-c"] \ No newline at end of file +WORKDIR / +RUN echo '#!/bin/bash' >> entrypoint.sh && \ + echo 'export LD_LIBRARY_PATH="$(echo ~/.nuget/packages/libclang.runtime.*/*/runtimes/*/native):$(echo ~/.nuget/packages/libclangsharp.runtime.*/*/runtimes/*/native):${LD_LIBRARY_PATH:-}"' >> entrypoint.sh && \ + echo 'export CPLUS_INCLUDE_PATH="$(echo /usr/lib/gcc/*/*/include):/usr/include:${CPLUS_INCLUDE_PATH:-}"' >> entrypoint.sh && \ + echo 'python3 SDL3-CS/generate_bindings.py "$@"' >> entrypoint.sh && \ + chmod +x entrypoint.sh + +ENTRYPOINT ["/entrypoint.sh"] \ No newline at end of file diff --git a/External/.dockerignore b/External/.dockerignore new file mode 100644 index 0000000..e69de29 diff --git a/SDL3-CS/generate_bindings.sh b/SDL3-CS/generate_bindings.sh index a24ee04..009e19a 100755 --- a/SDL3-CS/generate_bindings.sh +++ b/SDL3-CS/generate_bindings.sh @@ -3,11 +3,11 @@ set -eu pushd "$(dirname "$0")/../" >/dev/null -dotnet tool restore -dotnet restore --ucr SDL3-CS/SDL3-CS.csproj - -export LD_LIBRARY_PATH="$(echo ~/.nuget/packages/libclang.runtime.*/*/runtimes/*/native):$(echo ~/.nuget/packages/libclangsharp.runtime.*/*/runtimes/*/native):${LD_LIBRARY_PATH:-}" -export CPLUS_INCLUDE_PATH="$(echo /usr/lib/gcc/*/*/include):/usr/include:${CPLUS_INCLUDE_PATH:-}" +#dotnet tool restore +#dotnet restore --ucr SDL3-CS/SDL3-CS.csproj +# +#export LD_LIBRARY_PATH="$(echo ~/.nuget/packages/libclang.runtime.*/*/runtimes/*/native):$(echo ~/.nuget/packages/libclangsharp.runtime.*/*/runtimes/*/native):${LD_LIBRARY_PATH:-}" +#export CPLUS_INCLUDE_PATH="$(echo /usr/lib/gcc/*/*/include):/usr/include:${CPLUS_INCLUDE_PATH:-}" python3 SDL3-CS/generate_bindings.py "$@"