-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-build.sh
More file actions
executable file
·66 lines (58 loc) · 1.65 KB
/
docker-build.sh
File metadata and controls
executable file
·66 lines (58 loc) · 1.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/bin/bash
# Build and run the ModelSEED API Docker container.
#
# Run from the modelseed-api directory.
# Expects sibling repos to be cloned (see README).
set -e
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
PARENT_DIR="$(dirname "$SCRIPT_DIR")"
API_DIR_NAME="$(basename "$SCRIPT_DIR")"
# Check required repos exist
MISSING=0
for repo in ModelSEEDpy KBUtilLib ModelSEEDDatabase ModelSEEDTemplates cb_annotation_ontology_api; do
if [ ! -d "$PARENT_DIR/$repo" ]; then
echo "ERROR: Missing $PARENT_DIR/$repo"
MISSING=1
fi
done
if [ $MISSING -eq 1 ]; then
echo ""
echo "Clone missing repos first. See README.md for instructions."
exit 1
fi
# Create temporary .dockerignore in parent to exclude unrelated repos
# (only include the repos we need)
DOCKERIGNORE="$PARENT_DIR/.dockerignore"
CLEANUP_DOCKERIGNORE=0
if [ ! -f "$DOCKERIGNORE" ]; then
CLEANUP_DOCKERIGNORE=1
cat > "$DOCKERIGNORE" << 'EOF'
# Auto-generated by docker-build.sh — include only what we need
*
!modelseed-api/
!ModelSEEDpy/
!KBUtilLib/
!ModelSEEDDatabase/
!ModelSEEDTemplates/
!cb_annotation_ontology_api/
# Exclude .git dirs from deps (saves ~500MB+ in build context)
ModelSEEDpy/.git
KBUtilLib/.git
ModelSEEDDatabase/.git
ModelSEEDTemplates/.git
cb_annotation_ontology_api/.git
modelseed-api/.git
modelseed-api/.venv
modelseed-api/.claude
modelseed-api/tests
EOF
fi
cleanup() {
if [ $CLEANUP_DOCKERIGNORE -eq 1 ] && [ -f "$DOCKERIGNORE" ]; then
rm "$DOCKERIGNORE"
fi
}
trap cleanup EXIT
echo "Building from context: $PARENT_DIR"
echo "This may take a few minutes on first build..."
docker compose -f "$SCRIPT_DIR/docker-compose.yml" up --build "$@"