# syntax=docker/dockerfile:1
# Packages the binary deploy/build.sh already built (dist/bin/linux_<arch>/spinner),
# so the image needs no Go toolchain and no emulation. Build it with:
#   sh deploy/build.sh && docker buildx build .
FROM --platform=$BUILDPLATFORM alpine:3.22 AS prep
RUN mkdir /data && chown 65532:65532 /data

FROM scratch
ARG TARGETARCH
LABEL org.opencontainers.image.title="Spinner" \
      org.opencontainers.image.description="Minecraft hostname-routing reverse proxy" \
      org.opencontainers.image.source="https://git.veillax.com/Veillax/Spinner" \
      org.opencontainers.image.licenses="AGPL-3.0-only"
COPY --from=prep --chown=65532:65532 /data /data
COPY dist/bin/linux_${TARGETARCH}/spinner /spinner
USER 65532:65532
VOLUME ["/data"]
EXPOSE 25565 8080
ENTRYPOINT ["/spinner"]
CMD ["-config", "/data/spinner.json"]
