-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun.sh
32 lines (23 loc) · 827 Bytes
/
run.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
27
28
29
30
31
32
#!/bin/bash
if [ -z "$DEPLOY_ENV" ]; then
echo "Error: Please set the 'DEPLOY_ENV' environment variable."
exit 1
fi
if [ -z "$OP_SERVICE_ACCOUNT_TOKEN" ]; then
echo "Error: Please set the 'OP_SERVICE_ACCOUNT_TOKEN' environment variable."
exit 1
fi
shopt -s expand_aliases
set -x
alias op="docker run --rm -e OP_SERVICE_ACCOUNT_TOKEN 1password/op:2 op"
export OP_SERVICE_ACCOUNT_TOKEN=$OP_SERVICE_ACCOUNT_TOKEN
# Define environment variables
export DNS_NAME_APP=${DNS_NAME_APP}
export DNS_NAME_SERVER=${DNS_NAME_SERVER}
export OPENAI_API_KEY=$(op read "op://DevOps/openai-key/credential")
export DB_PATH=/server/database
export DATA_SOURCE_DIR=/server/data-sources
# Build and start the Docker containers
docker compose down
docker compose build --build-arg OPENAI_API_KEY=${OPENAI_API_KEY}
docker compose up -d