FROM golang:1.21 AS build

RUN apt-get update && apt-get install -y build-essential git bash curl ca-certificates

COPY . /src

WORKDIR /src

RUN make build

FROM busybox

COPY --from=build /src/bin /app

WORKDIR /app

RUN mkdir -p /app/socks /app/keys

EXPOSE 2222

ENV REBOUND_PUBLIC_HOST=127.0.0.1
ENV REBOUND_PUBLIC_PORT=2222
ENV REBOUND_HOST_KEY=/app/keys/host.key
ENV REBOUND_ADDRESS=:2222
ENV REBOUND_SOCK_DIR=/app/socks

CMD ["/app/server"]