-
Notifications
You must be signed in to change notification settings - Fork 885
Expand file tree
/
Copy pathdocker-dev.sh
More file actions
executable file
·77 lines (68 loc) · 1.97 KB
/
Copy pathdocker-dev.sh
File metadata and controls
executable file
·77 lines (68 loc) · 1.97 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
67
68
69
70
71
72
73
74
75
76
77
#!/bin/bash
# Helper script to run commands in the CI Docker container
# Usage:
# ./scripts/docker-dev.sh # Start interactive shell
# ./scripts/docker-dev.sh pull # Pull latest image
# ./scripts/docker-dev.sh make gen # Run make gen
set -e
IMAGE="ghcr.io/flyteorg/flyte/ci:v2"
WORKSPACE="/workspace"
# Color codes for output
GREEN='\033[0;32m'
BLUE='\033[0;34m'
NC='\033[0m' # No Color
# Get the repository root (parent of scripts directory)
REPO_ROOT="$(cd "$(dirname "$0")/.." && pwd)"
# Function to print colored messages
info() {
echo -e "${BLUE}🐳 $1${NC}"
}
success() {
echo -e "${GREEN}✓ $1${NC}"
}
# Handle special commands
case "$1" in
pull)
info "Pulling latest CI image..."
docker pull "$IMAGE"
success "Image pulled successfully"
exit 0
;;
help|--help|-h)
echo "Docker Development Helper"
echo ""
echo "Usage:"
echo " $0 Start interactive shell in CI container"
echo " $0 pull Pull the latest CI image"
echo " $0 <command> Run a command in the CI container"
echo ""
echo "Examples:"
echo " $0 # Interactive shell"
echo " $0 make gen # Generate protocol buffers"
echo " $0 buf lint # Lint protocol buffers"
echo " $0 cargo build # Build Rust crate"
exit 0
;;
esac
# Check if Docker is running
if ! docker info > /dev/null 2>&1; then
echo "Error: Docker is not running. Please start Docker and try again."
exit 1
fi
# Run interactively if no command provided
if [ $# -eq 0 ]; then
info "Starting interactive shell..."
docker run --rm -it \
-v "$REPO_ROOT:$WORKSPACE" \
-w "$WORKSPACE" \
"$IMAGE" \
bash
else
# Run the provided command
info "Running: $*"
docker run --rm \
-v "$REPO_ROOT:$WORKSPACE" \
-w "$WORKSPACE" \
"$IMAGE" \
"$@"
fi