build.sh.bak 1.1 KB

1234567891011121314151617181920212223242526272829
  1. # Configs of the docker images, you might have specify your own configs here.
  2. # type of database, support 'mysql' and 'postgres'
  3. DB_TYPE="postgres"
  4. DB_PASSWORD="YOUR_DB_PASSWORD"
  5. DB_RUN_NAME="YOUR_DB_RUN_NAME"
  6. HOST_PORT="YOUR_HOST_PORT"
  7. # Replace the database root password in database image Dockerfile.
  8. sed -i "s/THE_DB_PASSWORD/$DB_PASSWORD/g" images/$DB_TYPE/Dockerfile
  9. # Replace the database root password in gogits image deploy.sh file.
  10. sed -i "s/THE_DB_PASSWORD/$DB_PASSWORD/g" images/gogits/deploy.sh
  11. # Replace the database type in gogits image deploy.sh file.
  12. sed -i "s/THE_DB_TYPE/$DB_TYPE/g" images/gogits/deploy.sh
  13. # Build the database image
  14. cd images/$DB_TYPE
  15. docker build -t gogs/$DB_TYPE .
  16. #
  17. ## Build the gogits image
  18. cd ../gogits
  19. docker build -t gogs/gogits .
  20. #
  21. ## Run MySQL image with name
  22. docker run -d --name $DB_RUN_NAME gogs/$DB_TYPE
  23. #
  24. ## Run gogits image and link it to the database image
  25. echo "Now we have the $DB_TYPE image(running) and gogs image, use the follow command to start gogs service:"
  26. echo -e "\033[33m docker run -i -t --link $DB_RUN_NAME:db -p $HOST_PORT:3000 gogs/gogits \033[0m"