Skip to content

Commit

Permalink
Add version number arg to deploy script
Browse files Browse the repository at this point in the history
  • Loading branch information
cthiriet committed Feb 29, 2024
1 parent bd217bb commit 9377cd5
Showing 1 changed file with 30 additions and 8 deletions.
38 changes: 30 additions & 8 deletions docker/deploy.sh
Original file line number Diff line number Diff line change
@@ -1,24 +1,46 @@
#!/bin/bash

# Check if a version number was provided as an argument
if [ -z "$1" ]; then
echo "Usage: $0 <version-number>"
exit 1
fi

VERSION_NUMBER=$1

ACCOUNT_ID=$(aws sts get-caller-identity --query Account --output text)

if [ $? -ne 0 ]
then
exit 255
fi

REGION=us-west-2

CONTAINER_URI="${ACCOUNT_ID}.dkr.ecr.${REGION}.amazonaws.com/vllm:latest"
REPOSITORY_NAME="vllm"
CONTAINER_URI="${ACCOUNT_ID}.dkr.ecr.${REGION}.amazonaws.com/${REPOSITORY_NAME}"

# Log in to ECR
aws ecr get-login-password --region "${REGION}" | docker login --username AWS --password-stdin "${ACCOUNT_ID}".dkr.ecr."${REGION}".amazonaws.com
aws ecr describe-repositories --repository-names "vllm" --region "${REGION}" > /dev/null 2>&1

# Check if repository exists and create it if not.
aws ecr describe-repositories --repository-names "${REPOSITORY_NAME}" --region "${REGION}" > /dev/null 2>&1
if [ $? -ne 0 ]
then
aws ecr create-repository --repository-name "vllm" --region "${REGION}" > /dev/null
aws ecr create-repository --repository-name "${REPOSITORY_NAME}" --region "${REGION}" > /dev/null
fi

# Build the Docker image with specified build arguments.
if DOCKER_BUILDKIT=1 docker build . --target vllm-openai --tag "${REPOSITORY_NAME}" --build-arg max_jobs=8 --build-arg nvcc_threads=2
then
# Tagging both specific version and latest tag.
docker tag "${REPOSITORY_NAME}" "$CONTAINER_URI:${VERSION_NUMBER}"
docker tag "${REPOSITORY_NAME}" "$CONTAINER_URI:latest"

if docker build . --target vllm-openai --tag vllm --build-arg max_jobs=8 --build-arg nvcc_threads=2
then
docker tag vllm "$CONTAINER_URI"
docker push "$CONTAINER_URI"
fi
# Pushing both tags to ECR.
docker push "$CONTAINER_URI:${VERSION_NUMBER}"
docker push "$CONTAINER_URI:latest"
else
echo "Docker build failed."
exit 2
fi

0 comments on commit 9377cd5

Please sign in to comment.