Skip to content

Commit

Permalink
[COST-4899] add .dockerignore file (RedHatInsights#74)
Browse files Browse the repository at this point in the history
* [COST-4899] add .dockerignore file

* [COST-4899] create tmp dir for build-deploy
  • Loading branch information
maskarb authored Apr 10, 2024
1 parent 8fe6696 commit 3adc221
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Ignore everything
**

# ... except for dependencies and source
!default/
13 changes: 12 additions & 1 deletion build_deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,18 @@ if [[ -z "$QUAY_USER" || -z "$QUAY_TOKEN" ]]; then
exit 1
fi

DOCKER_CONF="$PWD/.docker"
# Create tmp dir to store data in during job run (do NOT store in $WORKSPACE)
export TMP_JOB_DIR=$(mktemp -d -p "$HOME" -t "jenkins-${JOB_NAME}-${BUILD_NUMBER}-XXXXXX")
echo "job tmp dir location: $TMP_JOB_DIR"

function job_cleanup() {
echo "cleaning up job tmp dir: $TMP_JOB_DIR"
rm -fr $TMP_JOB_DIR
}

trap job_cleanup EXIT ERR SIGINT SIGTERM

DOCKER_CONF="$TMP_JOB_DIR/.docker"
mkdir -p "$DOCKER_CONF"
docker --config="$DOCKER_CONF" login -u="$QUAY_USER" -p="$QUAY_TOKEN" quay.io
docker --config="$DOCKER_CONF" build -t "${IMAGE}:${IMAGE_TAG}" ${SCRIPT_DIR}
Expand Down

0 comments on commit 3adc221

Please sign in to comment.