Skip to content

Commit

Permalink
build(docker): #246 Add docker image to supplement public image (#247)
Browse files Browse the repository at this point in the history
New image builds off public image but adds real data and report
templates

Closes: #246
  • Loading branch information
AlexAxthelm authored Feb 27, 2024
1 parent 39963af commit e0e9d57
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 0 deletions.
9 changes: 9 additions & 0 deletions build/Dockerfile.private
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
FROM ghcr.io/rmi-pacta/workflow.transition.monitor:main

COPY pacta-data "/pacta-data"

COPY "templates.transition.monitor" "/templates.transition.monitor"
#
# set permissions for PACTA repos that need local content
RUN chmod -R a+rwX "/pacta-data" && \
chmod -R a+rwX "/templates.transition.monitor"
54 changes: 54 additions & 0 deletions build/build_private_docker.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
#! /bin/sh

# This script uses hardcoded parameters to define the versions for pacta data
# and templates.transition.monitor. make changes to this script and commit
# prior to running, so that the SHA tag that is pushed to registry is capable
# of tracking the inputs.
if [ -z "$(git status --porcelain)" ]; then
echo "Git status is clean. Proceeding."
else
echo "Commit changes to this script prior to running."
exit 1
fi

#requires being logged in to az
az acr login --name transitionmonitordockerregistry

pacta_data_share_url="https://pactadatadev.file.core.windows.net/workflow-data-preparation-outputs"
pacta_data_share_path="2023Q4_20240218T231047Z"

templates_remote="[email protected]:RMI-PACTA/templates.transition.monitor.git"
templates_branch="main"

registry="transitionmonitordockerregistry.azurecr.io"
remote_image="rmi_pacta_2023q4_pa2024ch"
remote_tag="$(git rev-parse HEAD)"

dir_temp="$(mktemp -d)"
echo "$dir_temp"

docker_image="rmi_pacta_private"
tag="latest"
local_tag="$docker_image":"$tag"

git clone -b "$templates_branch" "$templates_remote" --depth 1 "$dir_temp/templates.transition.monitor"|| exit 2

# exclude sqlite files from download
az storage copy -s "$pacta_data_share_url"/"$pacta_data_share_path" -d "$dir_temp/pacta-data" --recursive --exclude-pattern "*.sqlite"

docker build -f Dockerfile.private -t "$local_tag" "$dir_temp"

new_tag="$registry"/"$remote_image":"$remote_tag"

echo "Tagging $local_tag as $new_tag"
docker tag "$local_tag" "$new_tag"

docker push "$new_tag"

remote_tag="latest"
new_tag="$registry"/"$remote_image":"$remote_tag"
echo "Tagging $local_tag as $new_tag"
docker tag "$local_tag" "$new_tag"
docker push "$new_tag"

echo "Docker images uploaded to $registry"

0 comments on commit e0e9d57

Please sign in to comment.