From 6412aab67613f57da2db6c19f2593da3ade40426 Mon Sep 17 00:00:00 2001 From: kaashyapan Date: Sat, 2 May 2026 02:43:48 +0530 Subject: [PATCH 1/2] Fix Zig version in Dockerfile --- Dockerfile | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/Dockerfile b/Dockerfile index 6fd95ec..35d730d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -11,13 +11,14 @@ RUN apt-get update && apt-get install -y \ xz-utils \ && rm -rf /var/lib/apt/lists/* -# Install Zig (using latest stable release) -ARG ZIG_VERSION=0.13.0 -RUN wget https://ziglang.org/download/${ZIG_VERSION}/zig-linux-x86_64-${ZIG_VERSION}.tar.xz \ - && tar -xf zig-linux-x86_64-${ZIG_VERSION}.tar.xz \ - && mv zig-linux-x86_64-${ZIG_VERSION} /usr/local/zig \ +# Install Zig (minimum 0.15.2 ) +ARG ZIG_VERSION=0.15.2 + +RUN wget https://ziglang.org/download/${ZIG_VERSION}/zig-x86_64-linux-${ZIG_VERSION}.tar.xz \ + && tar -xf zig-x86_64-linux-${ZIG_VERSION}.tar.xz \ + && mv zig-x86_64-linux-${ZIG_VERSION} /usr/local/zig \ && ln -s /usr/local/zig/zig /usr/local/bin/zig \ - && rm zig-linux-x86_64-${ZIG_VERSION}.tar.xz + && rm zig-x86_64-linux-${ZIG_VERSION}.tar.xz # Set working directory WORKDIR /app From 3263e6c79715355894db5e91b4ad5d21f5e62812 Mon Sep 17 00:00:00 2001 From: kasyapan Date: Sat, 2 May 2026 03:35:45 +0530 Subject: [PATCH 2/2] Make multi stage build --- Dockerfile | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/Dockerfile b/Dockerfile index 35d730d..34898a1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM ubuntu:22.04 +FROM ubuntu:22.04 AS build # Install system dependencies RUN apt-get update && apt-get install -y \ @@ -32,8 +32,22 @@ RUN chmod +x build_wrapper.sh && ./build_wrapper.sh # Build Zig application RUN zig build -Doptimize=ReleaseFast -# Expose port -EXPOSE 8080 +# --- runtime stage --- + +FROM ubuntu:22.04 AS runtime + +RUN apt-get update && apt-get install -y \ + libphonenumber8 \ + libprotobuf23 \ + libicu70 \ + && rm -rf /var/lib/apt/lists/* -# Run the application -CMD ["./zig-out/bin/phonecheck"] +WORKDIR /app +COPY --from=build /app/zig-out/bin/phonecheck ./ +COPY --from=build /app/lib/libphonenumber_wrapper.so ./lib/ + +# Fix the shared lib path so the binary finds the wrapper +ENV LD_LIBRARY_PATH=/app/lib + +EXPOSE 8080 +CMD ["/app/phonecheck"]