Skip to content

Commit 5af85ce

Browse files
authored
Merge pull request #32 from FloRobart/dev
feat(fg script): Add update and version method into fg script
2 parents 8a12894 + 0ab3c13 commit 5af85ce

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed

fg.sh

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,12 @@ Commands:
1414
up [service...] Start the full stack or specific services
1515
down [options...] Stop and remove containers (passes extra flags to compose)
1616
restart [service...] Recreate the full stack or specific services
17+
update|upgrade <service> Pull the latest image(s) for the given service(s) then restart
1718
ps Show container status
1819
logs <service> Follow logs for a service
1920
pull [service...] Pull images for all or specific services
2021
exec <service> <cmd> Run a command inside a service container
22+
version Show version (prints the contents of the file 'version' with a trailing newline)
2123
help Show this help message
2224
2325
Examples:
@@ -45,6 +47,16 @@ case "$cmd" in
4547
restart)
4648
compose up -d --force-recreate "$@"
4749
;;
50+
update|upgrade)
51+
if [[ $# -lt 1 ]]; then
52+
echo "update requires at least one service name" >&2
53+
exit 1
54+
fi
55+
# Pull latest image(s) for the specified service(s)
56+
compose pull "$@"
57+
# Restart the service(s) with force recreate
58+
compose up -d --force-recreate "$@"
59+
;;
4860
ps|status)
4961
compose ps "$@"
5062
;;
@@ -67,6 +79,15 @@ case "$cmd" in
6779
shift
6880
compose exec "$service" "$@"
6981
;;
82+
version)
83+
if [[ -f version ]]; then
84+
cat version
85+
echo
86+
else
87+
echo "version file not found" >&2
88+
exit 1
89+
fi
90+
;;
7091
help|-h|--help)
7192
usage
7293
;;

version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.4.1
1+
1.5.0

0 commit comments

Comments
 (0)