2dust-v2rayn
SUCCESS
55m 50s
History Source
SummaryIterations3Transcript68Dockerfile
Dockerfile48 lines · 1541 chars
# Build stage: publish AmazTool Linux-x64 self-contained artifacts
FROM ubuntu:jammy-20260217 AS builder
ENV DEBIAN_FRONTEND=noninteractive

# Install prerequisites and .NET 8 SDK
RUN apt-get update \
    && apt-get install -y --no-install-recommends \
        ca-certificates \
        curl \
        gnupg \
        apt-transport-https \
        wget \
    && wget https://packages.microsoft.com/config/ubuntu/22.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb \
    && dpkg -i packages-microsoft-prod.deb \
    && apt-get update \
    && apt-get install -y --no-install-recommends dotnet-sdk-8.0 \
    && rm -f packages-microsoft-prod.deb \
    && rm -rf /var/lib/apt/lists/*

WORKDIR /src

# Copy source code
COPY . ./

# Restore and publish AmazTool for linux-x64 (single architecture per image)
RUN dotnet restore v2rayN/AmazTool/AmazTool.csproj
RUN dotnet publish v2rayN/AmazTool/AmazTool.csproj -c Release -r linux-x64 -p:SelfContained=true -o /output/linux-x64

# Runtime stage
FROM ubuntu:jammy-20260217

# Install runtime dependencies (minimal)
RUN apt-get update \
    && apt-get install -y --no-install-recommends ca-certificates \
    && rm -rf /var/lib/apt/lists/*

WORKDIR /app

# Copy published outputs from build stage
COPY --from=builder /output/linux-x64 /app/linux-x64

# Copy entrypoint wrapper script
COPY entrypoint.sh /usr/local/bin/entrypoint.sh
RUN chmod +x /usr/local/bin/entrypoint.sh

# Set entrypoint to wrapper that auto-discovers the main executable
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]