From 2426fbe46a4a71660ff7e6d4b90db80fda14b201 Mon Sep 17 00:00:00 2001 From: David Chang Date: Sat, 2 Mar 2024 11:34:49 -0500 Subject: [PATCH] Use custom network bridge instead of Docker default --- .env.example | 2 +- README.md | 2 ++ app/Dockerfile | 2 ++ db/init.sh | 19 ------------------- 4 files changed, 5 insertions(+), 20 deletions(-) diff --git a/.env.example b/.env.example index 8393786..fe57321 100644 --- a/.env.example +++ b/.env.example @@ -1,6 +1,6 @@ # Shared environment variables for ./app and ./db ENVIRONMENT=[development] -NETWORK_NAME=[bridge] +NETWORK_NAME=[api-bridge] MYSQL_PORT=[3306] DB_USER=[root] DB_PASSWORD=[password] diff --git a/README.md b/README.md index b738b81..6e655a0 100644 --- a/README.md +++ b/README.md @@ -7,6 +7,7 @@ RESTful API for interacting with me programmatically! `$ cp .env.example .env` - Fill out all the details for your local database (replace examples in brackets): - ENVIRONMENT=[development] + - NETWORK_NAME=[api-bridge] - MYSQL_PORT=[3306] - DB_USER=[root] - DB_PASSWORD=[password] @@ -31,6 +32,7 @@ RESTful API for interacting with me programmatically! `$ cp .env.example .env` - Fill out all the details for your local database (replace examples in brackets): - ENVIRONMENT=[development] + - NETWORK_NAME=[api-bridge] - MYSQL_PORT=[3306] - DB_USER=[root] - DB_PASSWORD=[password] diff --git a/app/Dockerfile b/app/Dockerfile index 2ce3740..6167e22 100644 --- a/app/Dockerfile +++ b/app/Dockerfile @@ -1,3 +1,5 @@ +# app/Dockerfile + FROM golang:latest WORKDIR /usr/src/app diff --git a/db/init.sh b/db/init.sh index 4b2aa6f..2fbe3bb 100755 --- a/db/init.sh +++ b/db/init.sh @@ -13,22 +13,3 @@ cat ./schema.sql >> ./init.sql # Done echo "init.sql file created" - -# Create the dynamic SQL script in a writable directory -# echo "CREATE DATABASE IF NOT EXISTS \`$DB_NAME\` ;" > /tmp/init.sql -# echo "USE \`$DB_NAME\` ;" >> /tmp/init.sql -# echo "source /docker-entrypoint-initdb.d/schema.sql;" >> /tmp/init.sql - -# # Move the script to the /docker-entrypoint-initdb.d/ directory -# sudo mv /tmp/init.sql /docker-entrypoint-initdb.d/ - -# Execute SQL commands directly using the mysql command -# echo "Creating database: \`$DB_NAME\`" -# mysql -h localhost -P $MYSQL_PORT -u $DB_USER -p$MYSQL_ROOT_PASSWORD -e "CREATE DATABASE IF NOT EXISTS \`$DB_NAME\` ;" -# echo "Using database: \`$DB_NAME\`" -# mysql -h localhost -P $MYSQL_PORT -u $DB_USER -p$MYSQL_ROOT_PASSWORD -e "USE \`$DB_NAME\` ;" -# echo "Running initialization" -# mysql -h localhost -P $MYSQL_PORT -u $DB_USER -p$MYSQL_ROOT_PASSWORD $DB_NAME < /docker-entrypoint-initdb.d/schema.sql - -# Call the original entrypoint script to start MySQL -#exec /entrypoint.sh "$@"