# Kasette node: the gateway (keys, uploads to Sia, media relay) with ffmpeg
# for the video qualities. Built from the repository root:
#   docker compose -f node/docker-compose.yml build
FROM node:22-bookworm-slim
RUN apt-get update && apt-get install -y --no-install-recommends ffmpeg ca-certificates && rm -rf /var/lib/apt/lists/*
WORKDIR /kasette
# The gateway checks signatures with the Kaspa SDK the site already ships.
COPY public/vendor/kaspa public/vendor/kaspa
COPY gateway/server.mjs gateway/renditions.mjs gateway/relay.mjs gateway/anchor.mjs gateway/
RUN mkdir /data && chown node:node /data
ENV KASETTE_DATA=/data PORT=8787
VOLUME /data
EXPOSE 8787
USER node
# Not for Akash: its persistent /data volume is owned by root and this user
# can't write to it (crash at start). Akash nodes use deploy/Dockerfile.
CMD ["node", "gateway/server.mjs"]
