-
Notifications
You must be signed in to change notification settings - Fork 24
Expand file tree
/
Copy pathrun-container.sh
More file actions
executable file
·41 lines (36 loc) · 1.29 KB
/
run-container.sh
File metadata and controls
executable file
·41 lines (36 loc) · 1.29 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
#!/bin/bash
# Build and run a backend container for testing.
#
# NOTE:
# This does not build or run the frontend. That would require additional
# framework to work around the NGINX dependency on the kubernetes backend
# service.
if [ ${DEBUG} ]; then set -ex ;fi
BRANCH="$(git rev-parse --show-toplevel)"
BACKEND="${BRANCH}/backend"
FRONTEND="${BRANCH}/frontend"
CPT_CONFIG=${CPT_CONFIG:-"${BACKEND}/ocpperf.toml"}
if [ ! -f "${CPT_CONFIG}" ]; then
echo "Error: ${CPT_CONFIG} not found" >&2
echo "Please update the ${CPT_CONFIG} file to meet your needs." >&2
exit 1
fi
export CONTAINERS=()
cleanup () {
set +e
if [[ "${NOCLEANUP}" -ne 1 && "${#CONTAINERS[@]}" -ne 0 ]]
then
echo "Cleaning up..."
podman stop "${CONTAINERS[@]}"
podman rm "${CONTAINERS[@]}"
else
echo "Leaving pod ${POD_NAME} running for debug"
fi
}
echo "Creating version"
( cd ${BACKEND}; poetry install ; poetry run scripts/version.py )
podman build -f backend.containerfile --tag backend "${BACKEND}"
echo "Starting backend container"
podman run -d --name="backend" -p 127.0.0.1:8000:8000 -v "${CPT_CONFIG}:/backend/ocpperf.toml:Z" localhost/backend
CONTAINERS=( "backend" )
echo -e "\n\n--------------\nWhen finished, type\n podman rm --force ${CONTAINERS[@]}\n--------------"