1 // Copyright (C) The Lightning Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
14 "git.arvados.org/arvados.git/lib/cmd"
15 "github.com/mattn/go-isatty"
16 "github.com/sirupsen/logrus"
20 handler = cmd.Multi(map[string]cmd.Handler{
21 "version": cmd.Version,
22 "-version": cmd.Version,
23 "--version": cmd.Version,
25 "ref2genome": &ref2genome{},
26 "vcf2fasta": &vcf2fasta{},
27 "import": &importer{},
28 "annotate": &annotatecmd{},
29 "export": &exporter{},
30 "export-numpy": &exportNumpy{},
32 "numpy-comvar": &numpyComVar{},
33 "filter": &filtercmd{},
34 "build-docker-image": &buildDockerImage{},
36 "pca-py": &pythonPCA{},
37 "plot": &pythonPlot{},
38 "diff-fasta": &diffFasta{},
41 "dumpgob": &dumpGob{},
46 if !isatty.IsTerminal(os.Stderr.Fd()) {
47 logrus.StandardLogger().Formatter = &logrus.TextFormatter{DisableTimestamp: true}
49 os.Exit(handler.RunCommand(os.Args[0], os.Args[1:], os.Stdin, os.Stdout, os.Stderr))
52 type buildDockerImage struct{}
54 func (cmd *buildDockerImage) RunCommand(prog string, args []string, stdin io.Reader, stdout, stderr io.Writer) int {
55 tmpdir, err := ioutil.TempDir("", "")
57 fmt.Fprint(stderr, err)
60 defer os.RemoveAll(tmpdir)
61 err = ioutil.WriteFile(tmpdir+"/Dockerfile", []byte(`FROM debian:bullseye
62 RUN DEBIAN_FRONTEND=noninteractive \
64 apt-get dist-upgrade -y && \
65 apt-get install -y --no-install-recommends bcftools bedtools samtools python2 python3-sklearn python3-matplotlib ca-certificates && \
69 fmt.Fprint(stderr, err)
72 docker := exec.Command("docker", "build", "--tag=lightning-runtime", tmpdir)
73 docker.Stdout = stdout
74 docker.Stderr = stderr
79 fmt.Fprintf(stderr, "built and tagged new docker image, lightning-runtime\n")