# Using Julia in a containerized Nextflow pipeline

**URL:** https://discourse.julialang.org/t/using-julia-in-a-containerized-nextflow-pipeline/67871
**Category:** General Usage
**Tags:** question, package
**Created:** [September 8, 2021, 12:33pm UTC](https://discourse.julialang.org/t/using-julia-in-a-containerized-nextflow-pipeline/67871 "2021-09-08T12:33:35Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![MillironX](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/millironx/32/28274_2.png) [@MillironX](https://discourse.julialang.org/u/MillironX)
#### Post date: [September 8, 2021, 12:33pm UTC](https://discourse.julialang.org/t/using-julia-in-a-containerized-nextflow-pipeline/67871/1 "2021-09-08T12:33:35Z")

</div>

I’m using Julia scripts inside of a container-based [Nextflow](https://nextflow.io) pipeline. Basically, the pipeline script will pull a fresh [Julia Singularity image](https://cloud.sylabs.io/library/millironx/default/julia), add the `bin` directory associated with the pipeline directory to `PATH`, and then execute the Julia scripts. I’m wondering what the best/most Julian way to handle package dependencies in such a situation is.

My current setup is to commit my `Project.toml` and `Manifest.toml` inside of the `bin` dir, like

```nohighlight
.
├── bin
│ ├── myscript
│ ├── library.jl
│ ├── Project.toml
│ └── Manifest.toml
├── main.nf
└── nextflow.config

```

The first few lines of `myscript` are then

```julia
#!/bin/bash
#=
julia --project="$(realpath "$(dirname "${BASH_SOURCE[0]}")")" -e 'using Pkg; Pkg.instantiate()'
exec julia --project="$(realpath "$(dirname "${BASH_SOURCE[0]}")")" "${BASH_SOURCE[0]}" "$@"
=#

```

which boils down to

1. Set the project directory and run `] instantiate`
2. Set the project directory and execute the file using Julia

in a manner similar to that [described in the manual](https://docs.julialang.org/en/v1/manual/faq/#How-do-I-pass-options-to-julia-using-#!/usr/bin/env?).

This setup works well enough, but it feels kind of hacky and I’m afraid it might break at larger scales. Is there a better way?
