-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy path_test_local
More file actions
executable file
·45 lines (36 loc) · 1.11 KB
/
_test_local
File metadata and controls
executable file
·45 lines (36 loc) · 1.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/usr/bin/env bash
#
# Run locally inside the project Docker image.
set -euo pipefail
IFS=$'\n\t'
if [[ ! -f ".env" ]]; then
echo "Missing .env file. Copy .env-template and configure required values." >&2
exit 1
fi
# shellcheck disable=SC1091
source .env
required_vars=(DOCKER_IMAGE_NAME DOCKER_IMAGE_TAG TF_VAR_CAT_ARCHITECTURE)
for var in "${required_vars[@]}"; do
if [[ -z "${!var:-}" ]]; then
echo "${var} must be set in .env" >&2
exit 1
fi
done
project_dir="$(pwd)"
image="${DOCKER_IMAGE_NAME}:${DOCKER_IMAGE_TAG}"
lambda_arch="${TF_VAR_CAT_ARCHITECTURE:-x86_64}"
platform_opt=(--platform linux/amd64)
if [[ "${lambda_arch}" == "arm64" ]]; then
platform_opt=(--platform linux/arm64)
fi
echo "Running inside ${image} (${platform_opt[0]})"
# hello_cmd=$'set -euo pipefail\nnode -v\nnode -e \'console.log("Lambda template hello world from " + process.version)\'\n'
run_cmd='python3 -m catch_analysis_tools.app.app'
set -x
docker run --rm --memory=1g "${platform_opt[@]}" \
--volume "${project_dir}:/app" \
--workdir /app \
"${image}" \
/bin/bash -lc "${run_cmd}"
set +x
echo "Container test completed."