FROM node:20-alpine

ARG PROTOC_VERSION=25.1
ARG PROTOC_GEN_TS_VERSION=1.8.2

RUN apk add --no-cache git curl unzip

RUN curl -sLO https://github.com/protocolbuffers/protobuf/releases/download/v${PROTOC_VERSION}/protoc-${PROTOC_VERSION}-linux-x86_64.zip && \
    unzip -o protoc-${PROTOC_VERSION}-linux-x86_64.zip -d /usr/local && \
    rm protoc-${PROTOC_VERSION}-linux-x86_64.zip

RUN npm install -g protoc-gen-ts@${PROTOC_GEN_TS_VERSION}

COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh

ENTRYPOINT ["/entrypoint.sh"]
