generated from mlibrary/python-starter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinit.sh
executable file
·26 lines (21 loc) · 906 Bytes
/
init.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/usr/bin/env bash
if [ -f ".env" ]; then
echo "🌎 .env exists. Leaving alone"
else
echo "🌎 .env does not exist. Copying .env-example to .env"
cp env.example .env
YOUR_UID=$(id -u)
YOUR_GID=$(id -g)
echo "🙂 Setting your UID (${YOUR_UID}) and GID (${YOUR_UID}) in .env"
docker run --rm -v ./.env:/.env alpine echo "$(sed s/YOUR_UID/${YOUR_UID}/ .env)" >.env
docker run --rm -v ./.env:/.env alpine echo "$(sed s/YOUR_GID/${YOUR_GID}/ .env)" >.env
fi
echo "🚢 Build docker images"
docker compose build
echo "📦 Build python packages"
docker compose run --rm app poetry install
echo "🧳 Run database migrations"
docker compose up -d database
docker compose run --rm app sh -c "cd aim/digifeeds/database && poetry run alembic upgrade heads"
echo "🗄️ Load statuses"
docker compose run --rm app sh -c "poetry run python aim/digifeeds/bin/load_statuses.py"