Skip to content

Commit 752a512

Browse files
committed
fixing docker
1 parent 3baa9db commit 752a512

File tree

3 files changed

+50
-7
lines changed

3 files changed

+50
-7
lines changed

.github/workflows/ci.yml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,19 @@ jobs:
8282
mkdir -p out
8383
docker run --rm --read-only \
8484
--tmpfs /tmp:rw,exec,mode=1777 \
85-
-v "${{ github.workspace }}/test_data:/data:ro" \
85+
-e BVS_READ_ONLY_DB=1 \
86+
-v "${{ github.workspace }}/out:/out" \
87+
biosynth:ci \
88+
synthetic \
89+
--output /out/genotypes/{index}.txt \
90+
--count 1 \
91+
--seed 42
92+
93+
docker run --rm --read-only \
94+
--tmpfs /tmp:rw,exec,mode=1777 \
95+
-e BVS_READ_ONLY_DB=1 \
8696
-v "${{ github.workspace }}/out:/out" \
8797
biosynth:ci \
8898
genotype-to-vcf \
89-
--input /data/274939/274939_X_X_GSAv3-DTC_GRCh38-12-06-2025.txt \
99+
--input /out/genotypes/0001.txt \
90100
--output /out/out.vcf

cli/src/commands/synthetic.rs

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,12 @@ pub fn run_synthetic(args: SyntheticArgs) -> Result<()> {
7171
bail!("Day range must be between 1 and 31");
7272
}
7373

74-
let sqlite_path = ensure_reference_db(Some(&args.sqlite), args.force_download)?;
75-
let store = StatsStore::connect(&sqlite_path)?;
74+
let sqlite_path = resolve_sqlite_path(&args)?;
75+
let store = if read_only_db_requested() {
76+
StatsStore::connect_read_only(&sqlite_path)?
77+
} else {
78+
StatsStore::connect(&sqlite_path)?
79+
};
7680
let references = store.all_references(args.limit)?;
7781
if references.is_empty() {
7882
bail!(
@@ -123,6 +127,26 @@ pub fn run_synthetic(args: SyntheticArgs) -> Result<()> {
123127
Ok(())
124128
}
125129

130+
fn read_only_db_requested() -> bool {
131+
match std::env::var("BVS_READ_ONLY_DB") {
132+
Ok(value) => matches!(
133+
value.to_ascii_lowercase().as_str(),
134+
"1" | "true" | "yes" | "on"
135+
),
136+
Err(_) => false,
137+
}
138+
}
139+
140+
fn resolve_sqlite_path(args: &SyntheticArgs) -> Result<PathBuf> {
141+
if read_only_db_requested() {
142+
let baked_in = PathBuf::from("/app/data/genostats.sqlite");
143+
if baked_in.exists() {
144+
return Ok(baked_in);
145+
}
146+
}
147+
ensure_reference_db(Some(&args.sqlite), args.force_download)
148+
}
149+
126150
fn write_single_file(
127151
path: &PathBuf,
128152
references: &[ReferenceVariant],

test-docker.sh

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
set -eu
33

44
IMAGE_TAG="${IMAGE_TAG:-biosynth:ci}"
5-
INPUT_FILE="${INPUT_FILE:-/data/274939/274939_X_X_GSAv3-DTC_GRCh38-12-06-2025.txt}"
65
OUTPUT_FILE="${OUTPUT_FILE:-/out/out.vcf}"
76

87
docker build -f docker/Dockerfile -t "${IMAGE_TAG}" .
@@ -11,9 +10,19 @@ mkdir -p out
1110

1211
docker run --rm --read-only \
1312
--tmpfs /tmp:rw,exec,mode=1777 \
14-
-v "$PWD/test_data:/data:ro" \
13+
-e BVS_READ_ONLY_DB=1 \
14+
-v "$PWD/out:/out" \
15+
"${IMAGE_TAG}" \
16+
synthetic \
17+
--output /out/genotypes/{index}.txt \
18+
--count 1 \
19+
--seed 42
20+
21+
docker run --rm --read-only \
22+
--tmpfs /tmp:rw,exec,mode=1777 \
23+
-e BVS_READ_ONLY_DB=1 \
1524
-v "$PWD/out:/out" \
1625
"${IMAGE_TAG}" \
1726
genotype-to-vcf \
18-
--input "${INPUT_FILE}" \
27+
--input /out/genotypes/0001.txt \
1928
--output "${OUTPUT_FILE}"

0 commit comments

Comments
 (0)