FROM alpine:latest

ARG VERSION
ARG TARGETARCH

RUN apk --no-cache add ca-certificates && \
    ARCH=$([ "$TARGETARCH" = "arm64" ] && echo aarch64 || echo x86_64) && \
    wget -q "https://g.eliaskohout.de/api/packages/eliaskohout/alpine/edge/main/${ARCH}/axolotl-${VERSION}-r0.apk" \
      -O /tmp/axolotl.apk && \
    apk add --no-cache --allow-untrusted /tmp/axolotl.apk && \
    rm /tmp/axolotl.apk

WORKDIR /data
EXPOSE 7000
ENTRYPOINT ["ax", "serve"]
