Skip to content

Commit

Permalink
Use custom network bridge instead of Docker default
Browse files Browse the repository at this point in the history
  • Loading branch information
davidianstyle committed Mar 2, 2024
1 parent 533cf3f commit 2426fbe
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 20 deletions.
2 changes: 1 addition & 1 deletion .env.example
Original file line number Diff line number Diff line change
@@ -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]
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand All @@ -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]
Expand Down
2 changes: 2 additions & 0 deletions app/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# app/Dockerfile

FROM golang:latest

WORKDIR /usr/src/app
Expand Down
19 changes: 0 additions & 19 deletions db/init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 "$@"

0 comments on commit 2426fbe

Please sign in to comment.