# --- Stage 1: Build Go Utilities --- FROM golang:1.24-alpine AS builder RUN apk add --no-cache git WORKDIR /app # Clone the specific Go repository RUN git clone https://github.com/bionomia/dwc_agent_golang.git . # Build the binaries RUN go build -o dwcagent ./cmd/dwcagent RUN go build -o dwcagent-server ./cmd/dwcagent-server # --- Stage 2: Main Python Environment --- FROM python:3.13-slim-bookworm # Install build essentials (using slim to keep size down) RUN apt-get update && apt-get install -y \ build-essential \ git \ wget \ unzip \ && rm -rf /var/lib/apt/lists/* # Create user RUN useradd -m -u 1000 user USER user ENV HOME=/home/user \ PATH=/home/user/.local/bin:/home/user/app:$PATH WORKDIR $HOME/app # Clone the Python repo RUN --mount=type=secret,id=GH_TOKEN,mode=0444,required=true \ git clone https://$(cat /run/secrets/GH_TOKEN)@github.com/geonomia/geonomia-processor.git . # Copy the go binary from the builder stage --- # In path so make can find it COPY --from=builder /app/dwcagent-server . COPY --from=builder /app/dwcagent . RUN pip install --no-cache-dir -r requirements.txt # Run the local name parser server in same RUN instruction as the make # cmd that calls scripts which communicate with it RUN --mount=type=secret,id=GBIF_DOWNLOAD_REQUEST_ID,mode=0444,required=true \ ./dwcagent-server & \ SERVER_PID=$! && \ sleep 2 && \ export GBIF_DOWNLOAD_REQUEST_ID=$(cat /run/secrets/GBIF_DOWNLOAD_REQUEST_ID) && \ make db && \ kill $SERVER_PID CMD ["datasette", "data/geonomia.db", "--metadata", "resources/metadata.json", "--plugins-dir", "plugins/", "--host", "0.0.0.0", "--port", "7860", "--setting", "sql_time_limit_ms", "3500"]