diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..f78abe2 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,11 @@ +.git +.github +.ipython +.jupyter +.pytest_cache +.venv +.vscode +CODE_OF_CONDUCT.md +CONTRIBUTING.md +Dockerfile +LICENSE diff --git a/Dockerfile b/Dockerfile index 4b637a3..2087969 100644 --- a/Dockerfile +++ b/Dockerfile @@ -12,9 +12,6 @@ ENV DEBIAN_FRONTEND=noninteractive # add tini RUN apt-get update -y && apt-get install -y --no-install-recommends tini git -# Install the project into `/app` -WORKDIR /app - # Enable bytecode compilation ENV UV_COMPILE_BYTECODE=1 @@ -27,6 +24,9 @@ ENV UV_NO_DEV=1 # Ensure installed tools can be executed out of the box ENV UV_TOOL_BIN_DIR=/usr/local/bin +# Install the project into `/app` +WORKDIR /app + # Install the project's dependencies using the lockfile and settings RUN --mount=type=cache,target=/root/.cache/uv \ --mount=type=bind,source=uv.lock,target=uv.lock \ @@ -46,8 +46,7 @@ ENV PATH="/app/.venv/bin:$PATH" RUN groupadd --system --gid 999 nonroot \ && useradd --system --gid 999 --uid 999 --create-home nonroot +COPY --chmod=+x ./scripts/entrypoint.sh /app/ # Use the non-root user to run our application USER nonroot - -# run the command using tini -ENTRYPOINT ["/usr/bin/tini", "--"] +ENTRYPOINT ["./entrypoint.sh"] diff --git a/scripts/entrypoint.sh b/scripts/entrypoint.sh new file mode 100755 index 0000000..c38a68f --- /dev/null +++ b/scripts/entrypoint.sh @@ -0,0 +1,26 @@ +#!/usr/bin/env bash +set -euo pipefail + +# Ensure at least one argument is provided +if [ "$#" -eq 0 ]; then + echo "Usage: $0 {uniref|uniprot} [args...]" + exit 1 +fi + +cmd="$1" +shift + +case "$cmd" in + uniref) + # Run the uniref pipeline with any additional arguments via tini + exec /usr/bin/tini -- uv run uniref_pipeline "$@" + ;; + uniprot) + # Run the uniprot pipeline with any additional arguments via tini + exec /usr/bin/tini -- uv run uniprot_pipeline "$@" + ;; + *) + echo "Error: unknown command '$cmd'; valid commands are 'uniref' or 'uniprot'." >&2 + exit 1 + ;; +esac