FROM gcr.io/pingcap-public/pingcap/alpine-glibc:alpine-3.14.6

# Install necessary tools
RUN apk add --no-cache bash curl ca-certificates

# Install tiup
RUN curl --proto '=https' --tlsv1.2 -sSf https://tiup-mirrors.pingcap.com/install.sh | sh

# Add tiup to PATH
ENV PATH="/root/.tiup/bin:$PATH"

# Set tiup mirror
RUN tiup mirror set https://tiup-mirrors.pingcap.com

# Install dumpling and tidb-lightning
RUN tiup install dumpling:v8.5.5 tidb-lightning:v8.5.5

# Verify installation
RUN tiup --version && tiup list dumpling && tiup list tidb-lightning

# Copy application binaries
COPY ./bin /command

RUN find /command -type f -exec chmod +x {} \;

CMD ["sh"]
