-
Notifications
You must be signed in to change notification settings - Fork 0
/
run.sh
executable file
·46 lines (32 loc) · 942 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
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/bin/bash
imageName="auth-service"
if [[ $1 == "dev" ]]; then
# Load environment variables from dev.env file
source dev.env
# Export environment variables
export $(sed 's/=.*//' dev.env)
# Run the app
docker compose -f ./docker-compose.dev.yaml up -d
go run cmd/myapp/main.go
# Stop the containers
docker compose -f ./docker-compose.dev.yaml down
elif [[ $1 == "compose" ]]; then
# Load environment variables from .env file
source .env
# Export environment variables
export $(sed 's/=.*//' .env)
# Run docker compose
docker compose up
# Stop the containers
docker compose down
elif [[ $1 == "build" ]]; then
# Build image
docker build -t $imageName .
elif [[ $1 == "push" ]]; then
# Tag image
docker tag $imageName srjchsv/$imageName
# Push image to remote registry
docker push srjchsv/$imageName
else
echo "Invalid argument."
fi