diff --git a/.github/workflows/dibbsVm.yml b/.github/workflows/dibbsVm.yml index 55dd5ae..7bb29d8 100644 --- a/.github/workflows/dibbsVm.yml +++ b/.github/workflows/dibbsVm.yml @@ -9,6 +9,7 @@ permissions: contents: read jobs: + build: runs-on: ubuntu-latest @@ -25,11 +26,7 @@ jobs: echo "::set-output name=version::$version" - name: Build dibbs-vm for dibbs-ecr-viewer - if: ${{ steps.extract.outputs.service == 'dibbs-ecr-viewer' }} - run: | - echo "Building dibbs-vm version ${{ steps.extract.outputs.version }} for ${{ steps.extract.outputs.service }}" - - - name: Build dibbs-vm for dibbs-query-connector - if: ${{ steps.extract.outputs.service == 'dibbs-query-connector' }} - run: | - echo "Building dibbs-vm version ${{ steps.extract.outputs.version }} for ${{ steps.extract.outputs.service }}" + uses: ./.github/workflows/packMachines.yml + with: + service: ${{ steps.extract.outputs.service }} + version: ${{ steps.extract.outputs.version }} diff --git a/.github/workflows/packMachines.yml b/.github/workflows/packMachines.yml index 117b849..973a11d 100644 --- a/.github/workflows/packMachines.yml +++ b/.github/workflows/packMachines.yml @@ -4,6 +4,22 @@ on: push: branches: - main + workflow_call: + inputs: + service: + required: true + type: string + version: + required: true + type: string + workflow_dispatch: + inputs: + service: + required: true + type: string + version: + required: true + type: string permissions: contents: read @@ -28,7 +44,7 @@ jobs: - provisioners: ${{ inputs.provisioners }} steps: - uses: actions/checkout@v4 - + - name: Set up Packer uses: hashicorp/setup-packer@1aa358be5cf73883762b302a3a03abd66e75b232 with: @@ -39,18 +55,29 @@ jobs: uses: docker/setup-qemu-action@4574d27a4764455b42196d70a065bc6853246a25 - name: Run `packer init` - working-directory: ./packer + working-directory: ./packer/ubuntu-server id: init run: "packer init ./ubuntu.pkr.hcl" - name: Run `packer validate` - working-directory: ./packer + working-directory: ./packer/ubuntu-server id: validate run: "packer validate ./ubuntu.pkr.hcl" + + - name: Build dibbs-ecr-viewer Packer Image + if: github.event_name == 'push' + working-directory: ./packer/ubuntu-server + run: packer build --var-file=dibbs-ecr-viewer.pkr.hcl ./ubuntu.pkr.hcl - ## TODO: Add matrixed provisioner build here - - name: Build Packer Image - working-directory: ./packer - run: packer build ./ubuntu.pkr.hcl + - name: Build dibbs-query-connector Packer Image + # if the event is a push to main + if: github.event_name == 'push' + working-directory: ./packer/ubuntu-server + run: packer build --var-file=dibbs-query-connector.pkr.hcl ./ubuntu.pkr.hcl + + - name: Build Workflow Call Packer Image + if: github.event_name == 'workflow_call' || github.event_name == 'workflow_dispatch' + working-directory: ./packer/ubuntu-server + run: packer build --var dibbs_service=${{ inputs.service }} --var dibbs_version=${{ inputs.version }} ./ubuntu.pkr.hcl ## TODO: Decide how to export artifact. \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..68baabe --- /dev/null +++ b/.gitignore @@ -0,0 +1,9 @@ +packer/ubuntu-server/build/* + +docker/dibbs-ecr-viewer/.env +docker/dibbs-ecr-viewer/ecr-viewer.wizard.env +docker/dibbs-ecr-viewer/ecr-viewer.env.bak + +docker/dibbs-query-connectory/.env +docker/dibbs-query-connectory/query-connectory.wizard.env +docker/dibbs-query-connectory/query-connectory.env.bak diff --git a/docker/ecr-viewer/docker-compose.yml b/docker/dibbs-ecr-viewer/docker-compose.yml similarity index 66% rename from docker/ecr-viewer/docker-compose.yml rename to docker/dibbs-ecr-viewer/docker-compose.yml index e6927d4..275b228 100644 --- a/docker/ecr-viewer/docker-compose.yml +++ b/docker/dibbs-ecr-viewer/docker-compose.yml @@ -2,7 +2,7 @@ version: '3.8' services: ecr-viewer: - image: ghcr.io/cdcgov/dibbs-ecr-viewer/ecr-viewer:v2.0.0-beta + image: ghcr.io/cdcgov/$DIBBS_SERVICE/ecr-viewer:$DIBBS_VERSION restart: always env_file: "ecr-viewer.env" ports: @@ -11,7 +11,7 @@ services: - dibbs ingestion: - image: ghcr.io/cdcgov/dibbs-ecr-viewer/ingestion:v2.0.0-beta + image: ghcr.io/cdcgov/$DIBBS_SERVICE/ingestion:$DIBBS_VERSION restart: always ports: - "8080:8080" @@ -19,7 +19,7 @@ services: - dibbs validation: - image: ghcr.io/cdcgov/dibbs-ecr-viewer/validation:v2.0.0-beta + image: ghcr.io/cdcgov/$DIBBS_SERVICE/validation:$DIBBS_VERSION restart: always ports: - "8081:8080" @@ -27,7 +27,7 @@ services: - dibbs fhir-converter: - image: ghcr.io/cdcgov/dibbs-ecr-viewer/fhir-converter:v2.0.0-beta + image: ghcr.io/cdcgov/$DIBBS_SERVICE/fhir-converter:$DIBBS_VERSION restart: always ports: - "8082:8080" @@ -35,7 +35,7 @@ services: - dibbs message-parser: - image: ghcr.io/cdcgov/dibbs-ecr-viewer/message-parser:v2.0.0-beta + image: ghcr.io/cdcgov/$DIBBS_SERVICE/message-parser:$DIBBS_VERSION restart: always ports: - "8083:8080" @@ -43,7 +43,7 @@ services: - dibbs trigger-code-reference: - image: ghcr.io/cdcgov/dibbs-ecr-viewer/trigger-code-reference:v2.0.0-beta + image: ghcr.io/cdcgov/$DIBBS_SERVICE/trigger-code-reference:$DIBBS_VERSION restart: always ports: - "8084:8080" @@ -51,9 +51,9 @@ services: - dibbs orchestration: - image: ghcr.io/cdcgov/dibbs-ecr-viewer/orchestration:v2.0.0-beta + image: ghcr.io/cdcgov/$DIBBS_SERVICE/orchestration:$DIBBS_VERSION env_file: "orchestration.env" - restart: always + restart: always ports: - "8085:8080" networks: diff --git a/docker/dibbs-ecr-viewer/ecr-viewer.env b/docker/dibbs-ecr-viewer/ecr-viewer.env new file mode 100644 index 0000000..24a6f38 --- /dev/null +++ b/docker/dibbs-ecr-viewer/ecr-viewer.env @@ -0,0 +1,22 @@ +AWS_REGION=${AWS_REGION} +ECR_BUCKET_NAME=${ECR_BUCKET_NAME} + +AZURE_STORAGE_CONNECTION_STRING=${AZURE_STORAGE_CONNECTION_STRING} +AZURE_CONTAINER_NAME=${AZURE_CONTAINER_NAME} + +HOSTNAME=0.0.0.0 + +NBS_AUTH=${NBS_AUTH} +NBS_PUB_KEY=${NBS_PUB_KEY} + +CONFIG_NAME=${CONFIG_NAME} + +DATABASE_URL=${DATABASE_URL} + +SQL_SERVER_USER=${SQL_SERVER_USER} +SQL_SERVER_PASSWORD=${SQL_SERVER_PASSWORD} +SQL_SERVER_HOST=${SQL_SERVER_HOST} +DB_CIPHER=${DB_CIPHER} + +DIBBS_SERVICE=dibbs-ecr-viewer +DIBBS_VERSION=${DIBBS_VERSION} diff --git a/docker/ecr-viewer/orchestration.env b/docker/dibbs-ecr-viewer/orchestration.env similarity index 100% rename from docker/ecr-viewer/orchestration.env rename to docker/dibbs-ecr-viewer/orchestration.env diff --git a/docker/dibbs-ecr-viewer/wizard.sh b/docker/dibbs-ecr-viewer/wizard.sh new file mode 100755 index 0000000..544b67d --- /dev/null +++ b/docker/dibbs-ecr-viewer/wizard.sh @@ -0,0 +1,214 @@ +#!/bin/bash + +# This script is a setup wizard for the eCR Viewer application. It guides the user through the process of configuring +# environment variables and setting up the necessary configurations for running the application using Docker Compose. +# +# Functions: +# - clear_dot_env: Clears the file. +# - display_intro: Displays an introductory message and documentation link. +# - config_name: Prompts the user to select a configuration name from a list of options. +# - set_dot_env_var: Prompts the user to input a value for a given environment variable, with an optional default value. +# - set_dot_vars: Sets environment variables based on the selected configuration name and calls relevant functions to set additional variables. +# - confirm_vars: Displays the current environment variables and prompts the user to confirm them. +# - restart_docker_compose: Restarts Docker Compose with the updated environment variables. +# - add_env: Adds a key-value pair to the wizard_env_file file. +# - pg: Sets environment variables for PostgreSQL configuration. +# - sqlserver: Sets environment variables for SQL Server configuration. +# - nbs: Sets environment variables for NBS (National Electronic Disease Surveillance System Base System) configuration. +# - aws: Sets environment variables for AWS configuration. +# - azure: Sets environment variables for Azure configuration. +# +# The script follows these steps: +# 1. Clears the wizard_env_file file. +# 2. Displays an introductory message. +# 3. Prompts the user to select a configuration name. +# 4. Sets environment variables based on the selected configuration. +# 5. Prompts the user to confirm the environment variables. +# 6. Replaces the contents of the ecr_viewer_env_file file with the contents of the wizard_env_file file. +# 7. Restarts Docker Compose with the updated environment variables. + +ecr_viewer_env_file="ecr-viewer.env" +ecr_viewer_env_file_bak="ecr-viewer.env.bak" +wizard_env_file="ecr-viewer.wizard.env" + +clear_dot_env() { + echo "" > "$wizard_env_file" +} + +display_intro() { + echo "" + echo -e "\e[1;32m**********************************************\e[0m" + echo -e "\e[1;32m* *\e[0m" + echo -e "\e[1;32m*\e[0m \e[1;37mWelcome to the eCR Viewer setup wizard\e[0m \e[1;32m*\e[0m" + echo -e "\e[1;32m* *\e[0m" + echo -e "\e[1;32m**********************************************\e[0m" + echo "" + echo -e "\e[1;32mDocumentation can be found at: \e[4;36mhttps://github.com/CDCgov/dibbs-vm\e[0m" + echo "" +} + +config_name() { + PS3=' + Please select your CONFIG_NAME: ' + options=("AWS_PG_NON_INTEGRATED" "AWS_SQLSERVER_NON_INTEGRATED" "AWS_INTEGRATED" "AZURE_INTEGRATED" "AZURE_PG_NON_INTEGRATED" "AZURE_SQLSERVER_NON_INTEGRATED" "Quit") + select opt in "${options[@]}" + do + echo "" + echo -e "\e[1;36m Setting: CONFIG_NAME=$opt\e[0m" + echo "" + case $opt in + "AWS_PG_NON_INTEGRATED") + CONFIG_NAME="AWS_PG_NON_INTEGRATED" + break + ;; + "AWS_SQLSERVER_NON_INTEGRATED") + CONFIG_NAME="AWS_SQLSERVER_NON_INTEGRATED" + break + ;; + "AWS_INTEGRATED") + CONFIG_NAME="AWS_INTEGRATED" + break + ;; + "AZURE_INTEGRATED") + CONFIG_NAME="AZURE_INTEGRATED" + break + ;; + "AZURE_PG_NON_INTEGRATED") + CONFIG_NAME="AZURE_PG_NON_INTEGRATED" + break + ;; + "AZURE_SQLSERVER_NON_INTEGRATED") + CONFIG_NAME="AZURE_SQLSERVER_NON_INTEGRATED" + break + ;; + "Quit") + break + ;; + *) echo "invalid option $REPLY";; + esac + done +} + +set_dot_env_var() { + value=$1 + default=$2 + read -rp $' \e[3m'"$value (default: $default):"$'\e[0m' choice + if [ -z "$choice" ]; then + choice=$default + fi + echo "" + echo -e " \e[1;36mSetting: $value=$choice\e[0m" + echo "" + add_env "$value" "$choice" +} + +set_dot_vars() { + add_env "CONFIG_NAME" $CONFIG_NAME + if [ "$CONFIG_NAME" == "AWS_PG_NON_INTEGRATED" ]; then + aws + nbs + pg + elif [ "$CONFIG_NAME" == "AWS_SQLSERVER_NON_INTEGRATED" ]; then + aws + nbs + sqlserver + elif [ "$CONFIG_NAME" == "AWS_INTEGRATED" ]; then + aws + nbs + pg + elif [ "$CONFIG_NAME" == "AZURE_INTEGRATED" ]; then + azure + nbs + pg + elif [ "$CONFIG_NAME" == "AZURE_PG_NON_INTEGRATED" ]; then + azure + nbs + pg + elif [ "$CONFIG_NAME" == "AZURE_SQLSERVER_NON_INTEGRATED" ]; then + azure + nbs + sqlserver + else + echo "Invalid configuration name. Please choose a valid configuration name." + exit 1 + fi +} + +confirm_vars() { + echo -e "\e[1;33mPlease confirm the following settings:\e[0m" + vars=$(cat "$wizard_env_file") + echo -e "\e[1;36m$vars\e[0m" + echo "" + read -p "Is this information correct? (y/n): " choice + if [ "$choice" != "y" ]; then + echo "Please run the script again and provide the correct information." + exit 1 + fi + echo -e "\e[1;32mSettings confirmed. Updating your configuration.\e[0m" + cp "$ecr_viewer_env_file" "$ecr_viewer_env_file_bak" + cat "$wizard_env_file" > "$ecr_viewer_env_file" + # export the environment variables for the current session + # needed for the docker compose file DIBBS_SERVICE and DIBBS_VERSION + export $(cat $ecr_viewer_env_file | xargs) +} + +restart_docker_compose() { + docker compose down + docker compose up -d +} + +add_env() { + echo "$1=$2" >> "$wizard_env_file" +} + +pg() { + set_dot_env_var "DATABASE_URL" "postgresql://postgres:password@localhost:5432/postgres" +} + +sqlserver() { + set_dot_env_var "SQL_SERVER_USER" "sa" + set_dot_env_var "SQL_SERVER_PASSWORD" "password" + set_dot_env_var "SQL_SERVER_HOST" "localhost" + set_dot_env_var "DB_CIPHER" "" +} + +nbs() { + set_dot_env_var "NBS_AUTH" true + set_dot_env_var "NBS_PUB_KEY" "" +} + +aws() { + set_dot_env_var "AWS_REGION" "us-east-1" + set_dot_env_var "ECR_BUCKET_NAME" "" +} + +azure() { + set_dot_env_var "AZURE_STORAGE_CONNECTION_STRING" "" + set_dot_env_var "AZURE_CONTAINER_NAME" "" +} + +docker_compose_vars() { + # parse ecr-viewer.env file for environment variables + echo -e "\e[1;33mParsing eCR Viewer for default environment variables...\e[0m" + echo "" + while IFS= read -r line; do + case $line in + DIBBS_SERVICE=*) + dibbs_service=$(echo "$line" | cut -d'=' -f2) + ;; + DIBBS_VERSION=*) + dibbs_version=$(echo "$line" | cut -d'=' -f2) + ;; + esac + done < "$ecr_viewer_env_file" + add_env "DIBBS_SERVICE" "$dibbs_service" + set_dot_env_var "DIBBS_VERSION" "$dibbs_version" +} + +clear_dot_env +display_intro +docker_compose_vars +config_name +set_dot_vars +confirm_vars +restart_docker_compose diff --git a/docker/ecr-viewer/ecr-viewer.env b/docker/ecr-viewer/ecr-viewer.env deleted file mode 100644 index 8e2236c..0000000 --- a/docker/ecr-viewer/ecr-viewer.env +++ /dev/null @@ -1,14 +0,0 @@ -AWS_REGION=${AWS_REGION} -ECR_BUCKET_NAME=${ECR_BUCKET_NAME} -HOSTNAME=0.0.0.0 -NEXT_PUBLIC_NON_INTEGRATED_VIEWER=${NEXT_PUBLIC_NON_INTEGRATED_VIEWER} -SOURCE=${SOURCE} -APP_ENV=${APP_ENV} -NBS_PUB_KEY=${NBS_PUB_KEY} -NEXT_PUBLIC_BASEPATH=${NEXT_PUBLIC_BASEPATH} -METADATA_DATABASE_TYPE=${METADATA_DATABASE_TYPE} -METADATA_DATABASE_SCHEMA=${METADATA_DATABASE_SCHEMA} -DATABASE_URL=${DATABASE_URL} -SQL_SERVER_USER=${SQL_SERVER_USER} -SQL_SERVER_PASSWORD=${SQL_SERVER_PASSWORD} -SQL_SERVER_HOST=${SQL_SERVER_HOST} \ No newline at end of file diff --git a/examples/aws/README.md b/examples/aws/README.md new file mode 100644 index 0000000..9fe588a --- /dev/null +++ b/examples/aws/README.md @@ -0,0 +1,19 @@ +# AWS AMI with user-data scripts + +This guide will help you launch a virtual machine (VM) in AWS using an AMI with user-data scripts. + +## Steps to Launch a VM with User-Data Scripts + +1. **Create a VM**: + - Go to the ec2 web interface. + - Click on "Launch Instance" and follow the wizard to configure your VM. + - In the "Configure Instance Details" step, add your user-data scripts under the "Advanced Details" section. + - The user-data scripts will execute during the VM's initialization. + +2. **Start the VM**: + - Once the user-data scripts are added, start the VM. + - The user-data scripts will execute during the VM's initialization. + +## Example User-Data Scripts + +TODO: Add example user-data scripts here. \ No newline at end of file diff --git a/examples/proxmox/README.md b/examples/proxmox/README.md new file mode 100644 index 0000000..ec6523f --- /dev/null +++ b/examples/proxmox/README.md @@ -0,0 +1,22 @@ +# Proxmox VM Launch with Hookscripts + +This guide will help you launch a virtual machine (VM) in Proxmox with hookscripts. + +## Steps to Launch a VM with Hookscripts + +1. **Create a VM**: + - Go to the Proxmox web interface. + - Click on "Create VM" and follow the wizard to configure your VM. + +2. **Add Hookscripts**: + - After creating the VM, go to the VM's options. + - Add your hookscripts under the "Hookscripts" section. + +3. **Start the VM**: + - Once the hookscripts are added, start the VM. + - The hookscripts will execute during the VM's lifecycle events. + +## Example Hookscripts + +## user scripts for proxmox +https://pve.proxmox.com/pve-docs/pve-admin-guide.html#_hookscripts \ No newline at end of file diff --git a/packer/ubuntu-server/dibbs-ecr-viewer.pkr.hcl b/packer/ubuntu-server/dibbs-ecr-viewer.pkr.hcl new file mode 100644 index 0000000..510b788 --- /dev/null +++ b/packer/ubuntu-server/dibbs-ecr-viewer.pkr.hcl @@ -0,0 +1,2 @@ +dibbs_service = "dibbs-ecr-viewer" +dibbs_version = "main" diff --git a/packer/ubuntu-server/dibbs-query-connector.pkr.hcl b/packer/ubuntu-server/dibbs-query-connector.pkr.hcl new file mode 100644 index 0000000..92f43ed --- /dev/null +++ b/packer/ubuntu-server/dibbs-query-connector.pkr.hcl @@ -0,0 +1,2 @@ +dibbs_service = "dibbs-query-connector" +dibbs_version = "main" diff --git a/packer/ubuntu-server/scripts/provision.sh b/packer/ubuntu-server/scripts/provision.sh index ecaf791..25a7212 100644 --- a/packer/ubuntu-server/scripts/provision.sh +++ b/packer/ubuntu-server/scripts/provision.sh @@ -1,3 +1,10 @@ +#!/bin/bash + +# loop through all .env files and export the variables +for file in $(find . -name "*.env"); do + export $(cat $file | xargs) +done + # Adjust Docker group permissions. groupadd docker usermod -aG docker ubuntu @@ -8,12 +15,27 @@ systemctl enable docker.service systemctl enable containerd.service systemctl start docker.service -# Clone Compose files -cd ~ -mkdir dev -cd dev -git clone https://github.com/CDCgov/dibbs-vm.git -cd dibbs-vm/docker/ecr-viewer +# Check if DIBBS_SERVICE is valid +# dibbs-ecr-viewer +# dibbs-query-connect +if [ "$DIBBS_SERVICE" == "dibbs-ecr-viewer" ] || [ "$DIBBS_SERVICE" == "dibbs-query-connect" ]; then + echo "DIBBS Service is valid. DIBBS_SERVICE=$DIBBS_SERVICE" +else + echo "DIBBS Service is not valid. DIBBS_SERVICE=$DIBBS_SERVICE" && exit 1 +fi + +# Clone the dibbs-vm repository +git clone --branch alis/21_2 https://github.com/CDCgov/dibbs-vm.git +cd "dibbs-vm/docker/$DIBBS_SERVICE" + +# ensures the DIBBS variables are set and accessible to the wizard +echo "DIBBS_SERVICE=$DIBBS_SERVICE" >> "ecr-viewer.env" +echo "DIBBS_VERSION=$DIBBS_VERSION" >> "ecr-viewer.env" +echo "" >> "ecr-viewer.env" + +# enables docker compose variables to stay set on reboot, DIBBS_SERVICE and DIBBS_VERSION +echo 'export $(cat '~/dibbs-vm/docker/$DIBBS_SERVICE/ecr-viewer.env' | xargs)' >> ~/.bashrc +echo 'export $(cat '~/dibbs-vm/docker/$DIBBS_SERVICE/orchestration.env' | xargs)' >> ~/.bashrc # Trigger initial docker compose to pull image data docker compose up -d \ No newline at end of file diff --git a/packer/ubuntu-server/ubuntu.pkr.hcl b/packer/ubuntu-server/ubuntu.pkr.hcl index c95a238..dbdd299 100644 --- a/packer/ubuntu-server/ubuntu.pkr.hcl +++ b/packer/ubuntu-server/ubuntu.pkr.hcl @@ -31,8 +31,18 @@ packer { } } +variable "dibbs_service" { + description = "The name of the service to be built" + type = string +} + +variable "dibbs_version" { + description = "The version of the service to be built" + type = string +} + source "qemu" "iso" { -vm_name = "ubuntu-2404-ecrViewer.raw" +vm_name = "ubuntu-2404-${ var.dibbs_service }-${var.dibbs_version}.raw" # Uncomment this block to use a basic Ubuntu 24.04 cloud image # iso_url = "https://cloud-images.ubuntu.com/releases/24.04/release/ubuntu-24.04-server-cloudimg-amd64.img" # iso_checksum = "sha256:28d2f9df3ac0d24440eaf6998507df3405142cf94a55e1f90802c78e43d2d9df" @@ -44,7 +54,7 @@ vm_name = "ubuntu-2404-ecrViewer.raw" disk_image = false memory = 4096 - output_directory = "build/os-base" + output_directory = "build/${ var.dibbs_service }-${var.dibbs_version}" //accelerator = "hvf" disk_size = "8000M" disk_interface = "virtio" @@ -83,12 +93,15 @@ build { sources = [ "source.qemu.iso" ] - provisioner "shell" { only = ["qemu.iso"] scripts = [ "scripts/provision.sh" ] + environment_vars = [ + "DIBBS_SERVICE=${ var.dibbs_service }", + "DIBBS_VERSION=${ var.dibbs_version }" + ] execute_command = "echo 'ubuntu' | {{.Vars}} sudo -S -E bash '{{.Path}}'" } diff --git a/packer/ubuntu-server/variables.pkr.hcl b/packer/ubuntu-server/variables.pkr.hcl deleted file mode 100644 index e69de29..0000000 diff --git a/utils/build.sh b/utils/build.sh new file mode 100755 index 0000000..6e8da42 --- /dev/null +++ b/utils/build.sh @@ -0,0 +1,27 @@ +#!/bin/bash + +cd ../packer/ubuntu-server/ || exit + +# check if the build directory exists +if [ -d "build/$1-$2" ]; then + echo "Build directory for that version already exists." + read -rp $' \e[3m'"Do you want to remove the build directory? (y/n):"$'\e[0m' choice + if [ "$choice" == "y" ]; then + rm -rf "build/$1-$2" + else + echo "Cannot continue with the build process." + exit 1 + fi +fi + +if [ -z "$1" ] || [ -z "$2" ]; then + echo "Usage: ./build.sh [DIBBS_SERVICE] [DIBBS_VERSION]" + echo "Example: ./build.sh dibbs-ecr-viewer 1.0.0" + echo "Example: ./build.sh dibbs-query-connect 1.0.0" + exit 1 +fi + +# Build the base image +packer build --var dibbs_service=$1 --var dibbs_version=$2 ./ubuntu.pkr.hcl + +cd ../../utils/ || exit