-
Adapt your code to read all inputs from
/input
and write all results to/output
. The tabular data shall be in files namedcohort_data.csv
under each of these directories. -
List the Python dependencies of your code in a
requirements.txt
file. Recommended: Use "pinned dependencies" as described in the [Python Dependencies section](Python Dependencies). -
Copy
example/Dockerfile
and make changes as need where there are comments beginning with: "# !! EDIT THIS:". -
Test by building and running the container locally:
./docker-run.sh path/to/input path/to/output
Debug and repeat until it works...
-
Sign in to AWS using the AWS CLI:
- Only the time: Create an AWS SSO profile:
aws sso configure
(you'll set a profile name here) aws sso login --profile <profile-name>
aws ecr get-login-password --region us-east-1 --profile awsinfra | docker login --username AWS --password-stdin 913123821419.dkr.ecr.us-east-1.amazonaws.com
- Only the time: Create an AWS SSO profile:
-
Choose a name to attach to the container as a "tag".
-
Find the Rhino Generalized Compute ECR repo name for your workgroup.
For example:
rhino-gc-workgroup-rhinohealthdev
-
Build and push the container to the Rhino ECR repo:
./docker-push.sh <ecr-repo-name> <your-tag>
docker-run.sh
: Build a docker container image and run it locally.docker-push.sh
: Build a docker container image and push it to a container image repository.example
: Complete working example ofDockerfile
andrequirements.in
files.compile-requirements.sh
: Utility script for creatingrequirements.txt
files with pinned dependencies.
docker-run.sh <input-dir> <output-dir>
This does a few things specific to local builds:
- Use Docker BuildKit to use the local pip cache.
- Make the docker container run as the local user to avoid creating files and dirs owned by root.
We highly recommend the following method for specifying dependencies:
- List only direct dependencies in
requirements.in
, with the appropriate version or range of supported versions. - Generate
requirements.txt
by running the includedcompile-requirements.sh
script.
This will list specific versions in requirements.txt
, of all direct and indirect Python dependencies.
This practice is called "pinning" dependencies. This ensures that all future installations will use exactly the same
versions of the same dependencies.