-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathdocker-entrypoint.sh
More file actions
56 lines (52 loc) · 2.35 KB
/
docker-entrypoint.sh
File metadata and controls
56 lines (52 loc) · 2.35 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
#!/bin/bash
set -e
# Display help information if no arguments are provided
if [ $# -eq 0 ]; then
VERSION=$(python -m python_gpt_po.main --version)
echo "GPT PO Translator Docker Container v$VERSION"
echo "==========================================="
echo
echo "Usage: docker run [docker options] ghcr.io/pescheckit/python-gpt-po [translator options]"
echo
echo "Volume Mounting:"
echo " You can mount any directory from your host system to any path inside the container."
echo " Format: -v /host/path:/container/path"
echo " The '/container/path' is what you'll use with the --folder parameter."
echo
echo "Configuration:"
echo " The tool automatically loads configuration from pyproject.toml files found in:"
echo " • Mounted volume directories"
echo " • The target translation folder and its parent directories"
echo " See examples/docker-pyproject.toml for Docker-optimized configuration."
echo
echo "Examples:"
echo " # Translate files in the current directory to German"
echo " docker run -v $(pwd):/data -e OPENAI_API_KEY=<your_key> ghcr.io/pescheckit/python-gpt-po --folder /data --lang de"
echo
echo " # Use an absolute path to a different directory"
echo " docker run -v /home/user/translations:/translations -e OPENAI_API_KEY=<your_key> ghcr.io/pescheckit/python-gpt-po --folder /translations --lang fr,es"
echo
echo " # Windows example (PowerShell)"
echo " docker run -v C:/Users/username/projects/locales:/locales -e OPENAI_API_KEY=<your_key> ghcr.io/pescheckit/python-gpt-po --folder /locales --lang de"
echo
echo " # MacOS example"
echo " docker run -v /Users/username/Documents/translations:/input -e OPENAI_API_KEY=<your_key> ghcr.io/pescheckit/python-gpt-po --folder /input --lang fr,es"
echo
echo " # List available models (no need for --folder or --lang)"
echo " docker run -e OPENAI_API_KEY=<your_key> ghcr.io/pescheckit/python-gpt-po --provider openai --list-models"
echo
echo "For full documentation, visit: https://github.com/pescheckit/python-gpt-po"
exit 0
fi
# Check if we need to display version
if [ "$1" = "--version" ]; then
python -m python_gpt_po.main --version
exit 0
fi
# Check if we need to display help
if [ "$1" = "--help" ] || [ "$1" = "-h" ]; then
python -m python_gpt_po.main --help
exit 0
fi
# Execute command with args
exec python -m python_gpt_po.main "$@"