forked from predibase/lorax
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
executable file
·30 lines (21 loc) · 657 Bytes
/
build.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
#!/bin/bash
# Exit if any command fails
set -ex
# Check if there are any uncommitted changes
if [[ -n $(git status -s) ]]; then
DIRTY="-dirty"
else
DIRTY=""
fi
# Get the latest commit SHA
COMMIT_SHA=$(git rev-parse --short HEAD)
# Combine the SHA and dirty status to form the complete tag
TAG="${COMMIT_SHA}${DIRTY}"
# Name of the Docker image
IMAGE_NAME="lorax"
# ECR Repository URL (replace with your actual ECR repository URL)
ECR_REPO="474375891613.dkr.ecr.us-west-2.amazonaws.com"
echo "Building ${IMAGE_NAME}:${TAG}"
# Build the Docker image
docker build -t ${IMAGE_NAME}:${TAG} .
docker tag ${IMAGE_NAME}:${TAG} ${IMAGE_NAME}:latest