Dockerfile51 lines · 1675 chars # Multistage Dockerfile to build AmazTool for Linux x64 (no GUI dependencies)
# Build stage: use Ubuntu to install .NET SDK and publish Linux x64 self-contained binaries
FROM ubuntu:22.04 AS build
ENV DEBIAN_FRONTEND=noninteractive
WORKDIR /src
# Install dependencies and .NET SDK 8.0
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
ca-certificates \
curl \
gnupg \
lsb-release \
wget \
&& rm -rf /var/lib/apt/lists/*
# Add Microsoft package repository and install .NET SDK 8.0
RUN wget https://packages.microsoft.com/config/ubuntu/22.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb \
&& dpkg -i packages-microsoft-prod.deb \
&& rm packages-microsoft-prod.deb \
&& apt-get update \
&& apt-get install -y --no-install-recommends dotnet-sdk-8.0 \
&& rm -rf /var/lib/apt/lists/*
# Copy all repository files
COPY . .
# Publish AmazTool (skip v2rayN.Desktop build due to missing submodules)
RUN dotnet publish v2rayN/AmazTool/AmazTool.csproj -c Release -r linux-x64 -p:SelfContained=true -o /app/linux-x64
# Final stage: runtime image with minimal libraries
FROM debian:bookworm-slim AS runtime
ENV DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=1
WORKDIR /app
# Install required libraries to run the self-contained AmazTool
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
libgcc1 \
libstdc++6 \
ca-certificates \
file \
&& rm -rf /var/lib/apt/lists/*
# Copy published binaries from build stage
COPY --from=build /app/linux-x64/. /app
# Default command to run AmazTool (CLI or helper tool)
ENTRYPOINT ["./AmazTool"]