this is my code:

#!/usr/bin/env nextflow

nextflow.enable.dsl=2


process INDEX {
    input:
    file(fasta)

    output:
    path(bwa)

    script:
    def prefix = task.ext.prefix ?: "${fasta.baseName}"
    def args   = task.ext.args ?: ''
    """
    mkdir bwa
    bwa \\
        index \\
        $args \\
        -p bwa/${prefix} \\
        $fasta
    """
}

process DEDUP {

    debug true

    cpus 10

    input:
    path(idx)
    tuple val(sample), file(reads)

    output:
    tuple val(sample), path("${sample}.dedup.bam"), emit: dedup_bam

    script:
    """
    echo ${sample}
    INDEX=`find -L ./ -name "*.amb" | sed 's/\\.amb\$//'`
    
    bwa mem \$INDEX ${reads} -t ${task.cpus} | \\
    samtools view -b | samtools sort --threads 5 -o ${sample}.bam \\
    && picard MarkDuplicates -I ${sample}.bam -O ${sample}.dedup.bam \\
    -M metrics.txt --REMOVE_DUPLICATES true && \\
    samtools index ${sample}.dedup.bam
    
    rm ${sample}.bam
    """
}

process CONSENSUS {
    publishDir "${out}/${sample}", mode: 'copy'
    debug true

    input:
    path(genelist)
    path(db)
    tuple val(sample), path(bam)
    path fasta
    val out

    output:
    path(sample)

    script:
    """
    mkdir ${out}/${sample}
    mkdir ${sample}
    for gene in \$(cat ${genelist}); do
        COORDS=\$(awk -F'\t' '{print \$5}' <(grep -w "\$gene" ${db}))
        
        samtools view -b ${bam} \$COORDS | \\
        samtools sort -o \$gene.bam && \\
        samtools index \$gene.bam && \\
        bcftools mpileup -Ou -f ${fasta} \$gene.bam > \$gene.bcf

        bcftools call --ploidy 1 -m \$gene.bcf -Oz -o \$gene.vcf.gz && \\
        tabix \$gene.vcf.gz && \\
        samtools faidx ${fasta} \$COORDS | \\
        bcftools consensus \$gene.vcf.gz > ${sample}/\$gene.fa

        rm \$gene.bam \$gene.bam.bai \$gene.bcf \$gene.vcf.gz \$gene.vcf.gz.tbi
    done
    """
}

workflow {
    fasta = Channel.fromPath(params.fasta)
    fastqs = Channel.fromFilePairs("${params.dir}/*_{1,2}.fastq*.gz")
    genelist = Channel.fromPath(params.genelist)
    db = Channel.fromPath(params.db)
    out = file(params.out)
    out.mkdir()

    idx = INDEX(fasta)
    bam = DEDUP(idx, fastqs)
    // CONSENSUS(genelist, db, bam, fasta, out)
}

and this is my ./samples dir:

ls -lh ../samples/                                                                                                                                                                                           
total 1.7G
-rw-r--r--. 1 alejandro alejandro 138M Dec  2 23:47 SRR6170145_1.fastq.gz
-rw-r--r--. 1 alejandro alejandro 149M Dec  2 23:48 SRR6170145_2.fastq.gz
-rw-r--r--. 1 alejandro alejandro 141M Dec  4 00:09 SRR6170205_1.fastq.gz
-rw-r--r--. 1 alejandro alejandro 131M Dec  4 00:10 SRR6170205_2.fastq.gz
-rw-r--r--. 1 alejandro alejandro 261M Dec  4 00:04 SRR6170260_1.fastq.gz
-rw-r--r--. 1 alejandro alejandro 277M Dec  4 00:06 SRR6170260_2.fastq.gz
-rw-r--r--. 1 alejandro alejandro 139M Dec  4 00:15 SRR6170338_1.fastq.gz
-rw-r--r--. 1 alejandro alejandro 147M Dec  4 00:16 SRR6170338_2.fastq.gz
-rw-r--r--. 1 alejandro alejandro 142M Dec  4 00:17 SRR6170513_1.fastq.gz
-rw-r--r--. 1 alejandro alejandro 151M Dec  4 00:21 SRR6170513_2.fastq.gz

why the workflow is running just for 1 sample???

nextflow run main.nf --fasta ../ref_genome/GCF_000017985.1_ASM1798v1_genomic.fna --genelist ../supp/genes.txt --db ../supp/REL606_ESSENTIAL_DB.txt --dir ../samples --out ./consensus                        (base)  ✔  00:36:48 
N E X T F L O W  ~  version 23.10.0
Launching `main.nf` [voluminous_descartes] DSL2 - revision: c24dd9d1cb
executor >  local (2)
[f1/3f0b5a] process > INDEX (1) [100%] 1 of 1 ✔
[6a/22b3ca] process > DEDUP (1) [100%] 1 of 1 ✔
SRR6170145

Completed at: 04-Dec-2023 00:38:33
Duration    : 1m 37s
CPU hours   : 0.3
Succeeded   : 2