build.sh 814 B

12345678910111213141516171819202122232425262728
  1. # Configs
  2. MYSQL_PASSWORD="kuajie8402"
  3. MYSQL_RUN_NAME="gogs_mysql"
  4. typeset -u MYSQL_ALIAS
  5. MYSQL_ALIAS="db"
  6. HOST_PORT="3000"
  7. # Replace the mysql root password in MySQL image Dockerfile.
  8. sed -i "s/THE_MYSQL_PASSWORD/$MYSQL_PASSWORD/g" images/mysql/Dockerfile
  9. # Replace the mysql root password in gogits image Dockerfile.
  10. sed -i "s/THE_MYSQL_PASSWORD/$MYSQL_PASSWORD/g" images/gogits/deploy.sh
  11. sed -i "s/THE_MYSQL_ALIAS/$MYSQL_ALIAS/g" images/gogits/deploy.sh
  12. # Build the MySQL image
  13. cd images/mysql
  14. docker build -t gogs/mysql .
  15. #
  16. ## Build the gogits image
  17. cd images/gogits
  18. docker build -t gogs/gogits .
  19. #
  20. ## Run MySQL image with name
  21. docker run -d --name $MYSQL_RUN_NAME gogs/mysql
  22. #
  23. ## Run gogits image and link it to the MySQL image
  24. docker run --link $MYSQL_RUN_NAME:$MYSQL_ALIAS -p $HOST_PORT:3000 gogs/gogits