MarkdownResume-Pipeline-Cli.../build/build-pipeline-client-markdown.sh

49 lines
2.1 KiB
Bash
Raw Permalink Normal View History

2025-01-09 20:54:08 +00:00
#!/usr/bin/env bash
# Enable bash strict mode
set -euo pipefail
IFS=$'\n\t'
# Check if the environment variables file exists
2025-01-09 22:24:09 +00:00
ENV_FILE="/env/ResumeVariables.env"
2025-01-09 20:54:08 +00:00
if [[ ! -f "$ENV_FILE" ]]; then
2025-01-09 22:24:09 +00:00
echo "Error: Inside script: Environment variables file not found at $ENV_FILE"
2025-01-09 20:54:08 +00:00
exit 1
fi
# Load environment variables
source "$ENV_FILE"
2025-01-09 21:20:37 +00:00
# Define paths using Docker volumes with default fallbacks
export INPUT_DIR="${ResumeInputDir:-/Resume-Input}" # Input directory
export OUTPUT_DIR="${ResumeOutputDir:-/Resume-Output}" # Output directory
export TEMP_DIR="${BuildTempDir:-$OUTPUT_DIR/Temp}" # Temporary files directory
export FINAL_DIR="${FinalDir:-$OUTPUT_DIR/Final}" # Final output directory
export CANDIDATE_INFO_DIR="${CandidateInfoDir:-$FINAL_DIR/candidate-info-sheet}" # Candidate info sheet directory
export CLIENT_VERSION_DIR="${ClientVersionDir:-$FINAL_DIR/client-version}" # Client version directory
export JOB_BOARD_VERSION_DIR="${JobBoardVersionDir:-$FINAL_DIR/job-board-version}" # Job board version directory
2025-01-09 20:54:08 +00:00
# Create necessary directories
echo "Setting up directories..."
2025-01-09 21:20:37 +00:00
mkdir -p "$TEMP_DIR" \
"$CANDIDATE_INFO_DIR" \
"$CLIENT_VERSION_DIR" \
"$JOB_BOARD_VERSION_DIR"
# Clean up from previous runs
echo "Cleaning up from previous runs..."
rm -v -f "$TEMP_DIR/JobBoard.yml" || true
rm -v -f "$TEMP_DIR/ClientSubmission.yml" || true
rm -v -f "$TEMP_DIR/CandidateInfoSheet.yml" || true
rm -v -f "$CANDIDATE_INFO_DIR/CandidateInfoSheet.md" || true
rm -v -f "$CANDIDATE_INFO_DIR/CandidateInfoSheet.pdf" || true
rm -v -f "$JOB_BOARD_VERSION_DIR/Candidate-Resume.md" || true
rm -v -f "$JOB_BOARD_VERSION_DIR/Candidate-Resume.pdf" || true
rm -v -f "$JOB_BOARD_VERSION_DIR/Candidate-Resume.doc" || true
rm -v -f "$CLIENT_VERSION_DIR/Candidate-Resume.md" || true
rm -v -f "$CLIENT_VERSION_DIR/Candidate-Resume.pdf" || true
rm -v -f "$CLIENT_VERSION_DIR/Candidate-Resume.doc" || true
2025-01-09 20:54:08 +00:00
# Run the pipeline server script
echo "Running the pipeline server script..."
2025-01-09 21:20:37 +00:00
/app/vendor/MarkdownResume-Pipeline/build/build-pipeline-server-markdown.sh