forked from Brandawg93/PeaNUT
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeploy.sh
More file actions
executable file
·71 lines (64 loc) · 1.77 KB
/
Copy pathdeploy.sh
File metadata and controls
executable file
·71 lines (64 loc) · 1.77 KB
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#!/bin/bash
set -e # Exit on any error
# Unified deploy script for Docker builds
# Usage: ./deploy.sh [local|test|production]
DEPLOY_TYPE=${1:-test}
PACKAGE_VERSION=$(cat package.json | jq --raw-output ".version")
case $DEPLOY_TYPE in
local)
echo "Creating a local image with version $PACKAGE_VERSION"
npm run fullcheck
if docker buildx build \
--platform linux/amd64 \
--tag brandawg93/peanut:local \
--tag brandawg93/peanut:${PACKAGE_VERSION} \
--load \
.; then
docker buildx stop
echo "Successfully built local image!"
else
docker buildx stop
echo "Error: Failed to build local image!" >&2
exit 1
fi
;;
test)
echo "Creating a test image for arm64 and amd64 with version $PACKAGE_VERSION"
npm run fullcheck
if docker buildx build \
--push \
--platform linux/arm64,linux/amd64 \
--tag brandawg93/peanut:test \
.; then
docker buildx stop
echo "Successfully deployed test image!"
else
docker buildx stop
echo "Error: Failed to deploy test image!" >&2
exit 1
fi
;;
production)
echo "Creating multi-platform images with version $PACKAGE_VERSION"
npm run fullcheck
if docker buildx build \
--push \
--platform linux/arm64,linux/amd64 \
--tag brandawg93/peanut:latest \
--tag brandawg93/peanut:${PACKAGE_VERSION} \
--tag brandawg93/peanut:test \
.; then
docker buildx stop
echo "Successfully deployed all platforms!"
else
docker buildx stop
echo "Error: Failed to deploy production images!" >&2
exit 1
fi
;;
*)
echo "Error: Invalid deploy type '$DEPLOY_TYPE'" >&2
echo "Usage: $0 [local|test|production]" >&2
exit 1
;;
esac