diff --git a/.gitignore b/.gitignore index 2910fda..75d6311 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,4 @@ /test *test* *lock +*crt \ No newline at end of file diff --git a/Cargo.toml b/Cargo.toml index ee8a11b..12fd3d5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,8 +1,8 @@ [workspace] + members = [ "all_sample_hamming_dist", "all_sample_nt_diffs", "mutations_of_interest_table", "plots", "check_chemistry", -] [workspace.dependencies] clap = { version = "4", features = ["derive"] } @@ -11,4 +11,7 @@ either = "1" zoe = { version = "0.0.19", default-features = false, features = [ "multiversion", ] } + +[profile.release] +strip = true csv = "1.3.1" diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..07bf6c8 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,61 @@ +# Create an argument to pull a particular version of an image + +#################################################################################################### +# BASE IMAGE +#################################################################################################### +FROM rustlang/rust:nightly-alpine AS builder + + +# Required certs for apk update +COPY ca.crt /root/ca.crt + +# Put certs in /etc/ssl/certs location +RUN cat /root/ca.crt >> /etc/ssl/certs/ca-certificates.crt + +RUN apk update && apk add --no-cache build-base + + +WORKDIR /app + +# Copy all scripts to docker images +COPY . . + +# This build step will cache the dependencies +RUN cargo build --release + + +FROM alpine:latest as deploy + +# May only be required for WSL. +# Required certs for apk update +COPY ca.crt /root/ca.crt + +# Put certs in /etc/ssl/certs location +RUN cat /root/ca.crt >> /etc/ssl/certs/ca-certificates.crt + +# Install system libraries of general use +RUN apk update && apk add --no-cache \ + bash \ + && rm -rf /var/lib/{apt,dpkg,cache,log} \ + && rm /root/ca.crt + +WORKDIR /app + +COPY --from=builder \ + /app/target/release/mutations_of_interest_table \ + /app/target/release/all_sample_nt_diffs \ + /app/target/release/all_sample_hamming_dist \ + /app/target/release/plots \ + /app/target/release/check_chemistry /app/ + +# Create working directory variable +ENV WORKDIR=/data + +# Set up volume directory in docker +VOLUME ${WORKDIR} + +# Set up working directory in docker +WORKDIR ${WORKDIR} + +# Export project directory to PATH +ENV PATH "$PATH:/app" diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..343e264 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,18 @@ +x-rust-image: &rust-image mira-oxide/rust-nightly + +x-data-volume: &data-volume + type: bind + source: /home/xpa3/mira-oxide/test + target: /data + +services: + mira-oxide: + container_name: mira-oxide + image: mira-oxide:latest + build: + context: . + dockerfile: Dockerfile + restart: always + volumes: + - *data-volume + command: tail -f /dev/null