FROM debian:bookworm-slim

RUN apt-get update && apt-get install -y curl dpkg

RUN curl -fsSL https://sing-box.app/gpg.key -o /etc/apt/keyrings/sagernet.asc
RUN chmod a+r /etc/apt/keyrings/sagernet.asc

RUN echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/sagernet.asc] https://deb.sagernet.org/ * *" | tee /etc/apt/sources.list.d/sagernet.list > /dev/null

RUN apt-get update && apt-get install -y sing-box

RUN mkdir -p /app/config

WORKDIR /app

COPY start.sh /app/start.sh
RUN chmod +x /app/start.sh