-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
25 lines (19 loc) · 718 Bytes
/
Dockerfile
File metadata and controls
25 lines (19 loc) · 718 Bytes
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
# Stage 1: Build the NativeAOT shared library
FROM mcr.microsoft.com/dotnet/sdk:10.0-aot AS build
WORKDIR /src
COPY native_lib/ native_lib/
# NativeAOT requires an explicit RID. Detect it from the container arch.
RUN ARCH=$(uname -m) && \
case "$ARCH" in \
aarch64) RID="linux-arm64" ;; \
x86_64) RID="linux-x64" ;; \
*) echo "Unsupported: $ARCH" && exit 1 ;; \
esac && \
dotnet publish native_lib/ -c Release -r "$RID" -o /build
# Stage 2: Ruby runtime with the native library
FROM ruby:4.0
WORKDIR /app
COPY ruby/ ruby/
COPY --from=build /build/NativeLib.so build/
RUN cd ruby && bundle install
CMD ["bundle", "exec", "--gemfile=ruby/Gemfile", "ruby", "ruby/benchmark.rb"]