FROM docker.m.daocloud.io/library/alpine:3.19

ARG FRP_VERSION=0.68.1

RUN apk add --no-cache curl \
    && curl -sL "https://github.com/fatedier/frp/releases/download/v${FRP_VERSION}/frp_${FRP_VERSION}_linux_amd64.tar.gz" \
       -o /tmp/frp.tar.gz \
    && tar xzf /tmp/frp.tar.gz -C /tmp \
    && cp /tmp/frp_${FRP_VERSION}_linux_amd64/frpc /usr/local/bin/frpc \
    && chmod +x /usr/local/bin/frpc \
    && rm -rf /tmp/frp_* /tmp/frp.tar.gz \
    && apk del curl

COPY deploy/frpc-entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh

ENTRYPOINT ["/bin/sh", "/entrypoint.sh"]