FROM getlago/lago@sha256:9f324f89596d1e2d194490a67b39da16cdc1365f0c2da91ccc445fa49a33a2ed
COPY research-license.rb /app/api/config/initializers/license.rb
COPY nginx.conf /etc/nginx/sites-enabled/default
COPY boot.sh /app/lab-boot.sh
COPY seed.rb /app/lab-seed.rb
COPY . /app/research-build
RUN ruby -e 'p="/app/front/index.html"; s=File.read(p); abort "Missing frontend body" unless s.include?("</body>"); link=%q{<a href="/research-source/" style="position:fixed;bottom:4px;left:8px;z-index:2147483647;background:#fff;color:#334155;padding:3px 8px;border:1px solid #cbd5e1;border-radius:4px;font:12px system-ui" aria-label="Research fork corresponding source">Research fork · Source code</a>}; File.write(p,s.sub("</body>",link+"</body>"))'
RUN sh /app/research-build/package-research-source.sh
RUN chmod +x /app/lab-boot.sh
ENV BILLING_RESEARCH_FEATURES=1 LAGO_DISABLE_PDF_GENERATION=true LAGO_DISABLE_SEGMENT=true LAGO_CREATE_ORG=true LAGO_ORG_NAME="Billing Research" LAGO_ORG_USER_EMAIL="research@example.local"
EXPOSE 8080
ENTRYPOINT ["/app/lab-boot.sh"]
