mirror of
https://github.com/seanmorley15/AdventureLog.git
synced 2025-08-03 20:25:18 +02:00
Add PostgreSQL client and SQL scripts for parks data
This commit is contained in:
parent
a6c3738c48
commit
a17c482522
4 changed files with 24 additions and 3 deletions
|
@ -4,6 +4,8 @@ FROM node:18-alpine AS external-website
|
||||||
# A small line inside the image to show who made it
|
# A small line inside the image to show who made it
|
||||||
LABEL Developers="Sean Morley"
|
LABEL Developers="Sean Morley"
|
||||||
|
|
||||||
|
RUN apk update && apk add postgresql-client
|
||||||
|
|
||||||
# The WORKDIR instruction sets the working directory for everything that will happen next
|
# The WORKDIR instruction sets the working directory for everything that will happen next
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
services:
|
services:
|
||||||
web:
|
web:
|
||||||
image: ghcr.io/seanmorley15/adventurelog:latest
|
build: .
|
||||||
ports:
|
ports:
|
||||||
- "3000:3000"
|
- "3000:3000"
|
||||||
environment:
|
environment:
|
||||||
|
@ -9,6 +9,8 @@ services:
|
||||||
- ORIGIN=http://localhost:3000
|
- ORIGIN=http://localhost:3000
|
||||||
depends_on:
|
depends_on:
|
||||||
- db
|
- db
|
||||||
|
volumes:
|
||||||
|
- ./sql:/sql
|
||||||
db:
|
db:
|
||||||
image: postgres
|
image: postgres
|
||||||
environment:
|
environment:
|
||||||
|
|
21
startup.sh
21
startup.sh
|
@ -9,8 +9,22 @@ wait_for_db() {
|
||||||
echo "Database is now available."
|
echo "Database is now available."
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Function to run SQL scripts
|
||||||
|
run_sql_scripts() {
|
||||||
|
echo "Running SQL scripts..."
|
||||||
|
|
||||||
|
# Define the path to your SQL scripts
|
||||||
|
SQL_SCRIPTS_PATH="/sql" # Replace with the path to your SQL scripts
|
||||||
|
|
||||||
|
# Run each SQL script in the directory using the DATABASE_URL
|
||||||
|
for sql_script in "$SQL_SCRIPTS_PATH"/*.sql; do
|
||||||
|
echo "Running script: $sql_script"
|
||||||
|
psql "$DATABASE_URL" -f "$sql_script"
|
||||||
|
done
|
||||||
|
echo "Finished running SQL scripts."
|
||||||
|
}
|
||||||
|
|
||||||
# Start your application here
|
# Start your application here
|
||||||
# Example: node build/index.js
|
|
||||||
# Print message
|
# Print message
|
||||||
echo "Starting AdventureLog"
|
echo "Starting AdventureLog"
|
||||||
|
|
||||||
|
@ -23,6 +37,9 @@ npm run generate
|
||||||
# Run database migration
|
# Run database migration
|
||||||
npm run migrate
|
npm run migrate
|
||||||
|
|
||||||
echo "The orgin to be set is: $ORIGIN"
|
# Run SQL scripts
|
||||||
|
run_sql_scripts
|
||||||
|
|
||||||
|
echo "The origin to be set is: $ORIGIN"
|
||||||
# Start the application
|
# Start the application
|
||||||
ORIGIN=$ORIGIN node build
|
ORIGIN=$ORIGIN node build
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue