FROM ubuntu:latest

RUN apt-get update
RUN apt-get install -y jq netcat-traditional ca-certificates curl
RUN rm -rf /var/lib/apt/lists/*

# Copy files into image
WORKDIR /app

# Install mkcert
RUN curl -JLO "https://dl.filippo.io/mkcert/latest?for=linux/amd64"
RUN chmod +x mkcert-v*-linux-amd64
RUN cp mkcert-v*-linux-amd64 /usr/local/bin/mkcert

# Download binaries
RUN curl -LO https://git.vdb.to/cerc-io/nitro/releases/download/v0.1.7/nitro
RUN curl -LO https://git.vdb.to/cerc-io/nitro/releases/download/v0.1.7/bridge

# Make binaries executable
RUN chmod +x ./nitro
RUN chmod +x ./bridge

# Verify that binaries are correctly setup
RUN ./nitro help
RUN ./bridge help
