-
Notifications
You must be signed in to change notification settings - Fork 25
Expand file tree
/
Copy pathbuild.production.sh
More file actions
executable file
·38 lines (31 loc) · 981 Bytes
/
build.production.sh
File metadata and controls
executable file
·38 lines (31 loc) · 981 Bytes
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
33
34
35
36
37
38
#!/bin/bash
# Check if .env file exists in client/ directory
if [ ! -f client/.env ]; then
echo ".env file not found in the client/ directory."
exit 1
fi
# Check if .env file exists in server/ directory
if [ ! -f server/.env ]; then
echo ".env file not found in the server/ directory."
exit 1
fi
echo "All required .env files are present."
# Load environment variables from server/.env
export $(grep -v '^#' server/.env | xargs)
# Check if APP_PORT is passed as an argument, otherwise use the value from .env
if [ -z "$1" ]; then
if [ -z "$APP_PORT" ]; then
echo "APP_PORT is not set in the environment or passed as an argument."
exit 1
else
CONTAINER_PORT=$APP_PORT
echo "Using CONTAINER_PORT from environment: $CONTAINER_PORT"
fi
else
CONTAINER_PORT=$1
echo "Using provided CONTAINER_PORT: $CONTAINER_PORT"
fi
# build the docker image
docker build -t quickmeet .
# start the container
docker run -d -p $CONTAINER_PORT:$APP_PORT quickmeet