Skip to content

Commit

Permalink
Merge pull request #14 from amirhnajafiz/13-add-docker-commands
Browse files Browse the repository at this point in the history
13 add docker commands
  • Loading branch information
amirhnajafiz authored Aug 14, 2022
2 parents 88967e4 + a124ee9 commit c01b77a
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 3 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

<p align="center">
<img src="https://img.shields.io/badge/Docker-3.9-66ADD8?style=for-the-badge&logo=docker" alt="go version" />
<img src="https://img.shields.io/badge/Version-1.1.0-informational?style=for-the-badge&logo=none" alt="version" />
<img src="https://img.shields.io/badge/Version-1.1.2-informational?style=for-the-badge&logo=none" alt="version" />
</p>

Dockerize your Golang applications under Captain *Mustache*.
Expand Down Expand Up @@ -39,12 +39,12 @@ you start your application.

Now use the following command to start the container:
```shell
docker-compose up -d
./bin/mustache up
```

For stopping the container, use:
```shell
docker-compose down
./bin/mustache down
```

## Supports
Expand Down
51 changes: 51 additions & 0 deletions bin/mustache
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,57 @@ function select_opt {

############################################################

## docker functions ##

function docker_up() {
# shellcheck disable=SC2059
printf "${BIBlue}Ship is going up ...${color_off}\n"

if [ "$MACHINE" == "linux" ]; then
# shellcheck disable=SC2006
X=`docker-compose up -d`
# printf "${BIGreen}$X${color_off}\n"
else
# shellcheck disable=SC2006
X=`docker compose up -d`
# printf "${BIGreen}$X${color_off}\n"
fi

exit 0
}

function docker_down() {
# shellcheck disable=SC2059
printf "${BIBlue}Ship is going down ...${color_off}\n"

if [ "$MACHINE" == "linux" ]; then
# shellcheck disable=SC2006
X=`docker-compose down`
# printf "${BIGreen}$X${color_off}\n"
else
# shellcheck disable=SC2006
X=`docker compose down`
# printf "${BIGreen}$X${color_off}\n"
fi

exit 0
}

####################

# Docker commands
if [ "$#" -gt 0 ]; then
if [ "$1" == "up" ]; then
docker_up
elif [ "$1" == "down" ]; then
docker_down
else
# shellcheck disable=SC2059
printf "${On_Red}Fatal: unknown command${color_off} ${BIRed}$1${color_off}\n"
exit 1
fi
fi

# Execute
# shellcheck disable=SC2059
printf "Welcome to ${IBlue}Golang Mustache${color_off} ...\n\n"
Expand Down

0 comments on commit c01b77a

Please sign in to comment.