Skip to content

Commit

Permalink
#67 adapt compose dev to get image from github and quay
Browse files Browse the repository at this point in the history
  • Loading branch information
Marcellino-Palerme committed Dec 5, 2024
1 parent 19e1064 commit db3d84a
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 8 deletions.
17 changes: 9 additions & 8 deletions compose.dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,27 @@
services:

api:
image: inraep2m2/service-p2m2tools-api:latest
image: ghcr.io/p2m2/service-p2m2tools-api:latest
container_name: p2m2ToolsApi
ports:
- "8080:8080"
volumes:
- ./shareFile:/shareFile

db:
image: postgres:latest
image: quay.io/fedora/postgresql-16:latest
container_name: db
ports:
- "5432:5432"
volumes:
- ./db/init.sql:/docker-entrypoint-initdb.d/init.sql
- ./db:/usr/share/container-scripts/postgresql/start
environment:
POSTGRES_PASSWORD: ${PGPASSWORD}
POSTGRES_USER: ${PGUSER}
POSTGRES_PORT: ${PGPORT}
POSTGRES_HOST: ${PGHOST}
POSTGRES_DB: ${PGDATABASE}
POSTGRESQL_PASSWORD: ${PGPASSWORD}
POSTGRESQL_USER: ${PGUSER}
POSTGRESQL_PORT: ${PGPORT}
POSTGRESQL_HOST: ${PGHOST}
POSTGRESQL_DATABASE: ep2m2db
POSTGRESQL_ADMIN_PASSWORD: ${PGPASSWORD}

volumes:
shareFile:
Expand Down
13 changes: 13 additions & 0 deletions db/init.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash

# Initialize the database
echo "Initializing the database..."

# Define password for user
psql -U postgres -c "ALTER USER $POSTGRESQL_USER WITH PASSWORD '$POSTGRESQL_PASSWORD';"
# Give all privileges to the user on the database
psql -U postgres -c "GRANT ALL PRIVILEGES ON DATABASE $POSTGRESQL_DATABASE TO $POSTGRESQL_USER;"
# Initialize the database
psql -U $POSTGRESQL_USER -d $POSTGRESQL_DATABASE -f /usr/share/container-scripts/postgresql/start/init.sql

echo "Database initialization complete."

0 comments on commit db3d84a

Please sign in to comment.