Skip to content

Commit

Permalink
Update build process.
Browse files Browse the repository at this point in the history
  • Loading branch information
wsalesky committed Feb 8, 2024
1 parent e4e7bb7 commit b6c0351
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 19 deletions.
3 changes: 1 addition & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,4 @@ HEALTHCHECK CMD [ "java", \

ENV ADMIN_PASSWORD=$ADMIN_PASSWORD

ENTRYPOINT [ "/busybox/sh", "/entrypoint.sh"]

ENTRYPOINT [ "/busybox/sh", "/entrypoint.sh"]
33 changes: 16 additions & 17 deletions build/workflow.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
GITHUB_ORG="srophe"
GITHUB_REPOSITORY="bethqatraye-data"

# remove any old auto deploy
rm -rf autodeploy
# create an autodeploy folder
mkdir autodeploy

echo "Running app build ..."
ant
echo "Ran app build successfully"

echo "Fetching the data repository to build a data xar"
git clone https://github.com/$GITHUB_ORG/$GITHUB_REPOSITORY

Expand All @@ -12,15 +21,6 @@ ant
echo "Ran data build successfully"

cd ..
# remove any old auto deploy
rm -rf autodeploy
# create an autodeploy folder
mkdir autodeploy

echo "Running app build ..."
ant
echo "Ran app build successfully"


# move the xar from build to autodeploy
mv build/*.xar autodeploy/
Expand All @@ -44,25 +44,24 @@ VERSION=$(cat expath-pkg.xml | grep package | grep version= | awk -F'version="'
# GET the package name of the project from the expath-pkg.xml file
PACKAGE_NAME=$(cat expath-pkg.xml | grep package | grep version= | awk -F'abbrev="' '{ print $2 }' | awk -F'"' '{ print tolower($1) }')

DOCKER_URL=$AWS_ACCOUNT_ID.dkr.ecr.$AWS_REGION.amazonaws.com/$ECR_REPOSITORY:latest

echo "Deploying app $PACKAGE_NAME:$VERSION"
echo "Deploying as $DOCKER_URL"


echo "Building docker file"
docker build -t $PACKAGE_NAME:$VERSION --build-arg ADMIN_PASSWORD="$ADMIN_PASSWORD" --no-cache .
docker build -t "$PACKAGE_NAME:$VERSION" --build-arg ADMIN_PASSWORD="$ADMIN_PASSWORD" --no-cache .
echo docker build -t "$PACKAGE_NAME:$VERSION" --build-arg ADMIN_PASSWORD="$ADMIN_PASSWORD" --no-cache .
echo "Built successfully"

echo "Tagging Docker file"
docker tag $PACKAGE_NAME:$VERSION $DOCKER_URL
echo "Tagged successfully"
DOCKER_URL=$AWS_ACCOUNT_ID.dkr.ecr.$AWS_REGION.amazonaws.com/$ECR_REPOSITORY:latest

echo "Loging in to AWS"
# Get the aws docker login creds. Note: only works if the github repo is allowed access from OIDC
aws ecr get-login-password --region $AWS_REGION | \
docker login --username AWS --password-stdin $AWS_ACCOUNT_ID.dkr.ecr.$AWS_REGION.amazonaws.com
echo "Logged in successfully"

docker tag $PACKAGE_NAME:$VERSION $DOCKER_URL
echo "Pushing to $DOCKER_URL"
docker push $DOCKER_URL

echo "Pushed successfully, wait for a few minutes to see the changes reflected"
echo "Pushed successfully, wait for a few minutes to see the changes reflected"

0 comments on commit b6c0351

Please sign in to comment.