progress
This commit is contained in:
parent
e1bc3ee663
commit
99e9516830
19
trading_simulator/Dockerfile
Normal file
19
trading_simulator/Dockerfile
Normal file
@ -0,0 +1,19 @@
|
||||
FROM python:3.12-slim
|
||||
|
||||
COPY requirements.txt /
|
||||
|
||||
RUN pip install --upgrade pip --root-user-action=ignore
|
||||
RUN pip install -r /requirements.txt --root-user-action=ignore
|
||||
|
||||
COPY cvttpy /cvttpy
|
||||
|
||||
RUN mkdir -p /logs /config
|
||||
|
||||
SHELL ["/bin/bash", "-c"]
|
||||
|
||||
ENV PYTHONPATH=/
|
||||
|
||||
COPY entrypoint.sh /entrypoint.sh
|
||||
RUN chmod +x /entrypoint.sh
|
||||
|
||||
ENTRYPOINT ["/entrypoint.sh"]
|
||||
1
trading_simulator/VERSION
Normal file
1
trading_simulator/VERSION
Normal file
@ -0,0 +1 @@
|
||||
0.0.1
|
||||
87
trading_simulator/build.sh
Executable file
87
trading_simulator/build.sh
Executable file
@ -0,0 +1,87 @@
|
||||
#!/bin/bash
|
||||
|
||||
# --- Settings
|
||||
RegistryService=cloud21.cvtt.vpn:5500
|
||||
ImageName=trading_simulator
|
||||
BashFunctionCode=$(realpath $(dirname ${0}))/../dckr_bld_functions.sh
|
||||
ImageVersion=$(cat $(realpath $(dirname ${0}))/VERSION)
|
||||
# --- Settings
|
||||
|
||||
usage() {
|
||||
echo "Usage: $0 -L <library>:<library_version> [-V <image_version>] "
|
||||
exit 1
|
||||
}
|
||||
|
||||
|
||||
# ---------------- cmdline
|
||||
while getopts "I:V:L:" opt; do
|
||||
case ${opt} in
|
||||
V )
|
||||
ImageVersion=$OPTARG
|
||||
;;
|
||||
L )
|
||||
Library=$OPTARG
|
||||
;;
|
||||
\? )
|
||||
echo "Invalid option: -$OPTARG" >&2
|
||||
usage
|
||||
;;
|
||||
: )
|
||||
echo "Option -$OPTARG requires an argument." >&2
|
||||
usage
|
||||
;;
|
||||
esac
|
||||
done
|
||||
# ---------------- cmdline
|
||||
|
||||
if [ "${ImageName}" == "" ]
|
||||
then
|
||||
usage
|
||||
fi
|
||||
|
||||
if [ "${ImageVersion}" == "" ]
|
||||
then
|
||||
usage
|
||||
fi
|
||||
|
||||
DockerDir=$(realpath $(dirname ${0})/${ImageName})
|
||||
cd ${DockerDir}
|
||||
|
||||
Project=
|
||||
ProjectVersion=
|
||||
if [ "${Library}" != "" ] ; then
|
||||
IFS=':' read -ra parts <<< "${Library}"
|
||||
Project=${parts[0]}
|
||||
ProjectVersion=${parts[1]}
|
||||
fi
|
||||
# exit
|
||||
|
||||
build_musvc_image() {
|
||||
ImageName=${1}
|
||||
Project=${2}
|
||||
ProjectVersion=${3}
|
||||
|
||||
DockerDir=$(realpath $(dirname ${0}))
|
||||
cd ${DockerDir}
|
||||
|
||||
if [ "${Project}" != "" ]; then
|
||||
get_project_version ${Project} ${ProjectVersion}
|
||||
fi
|
||||
|
||||
function cleanup {
|
||||
cd ${DockerDir}
|
||||
rm -rf cvttpy
|
||||
}
|
||||
trap cleanup RETURN
|
||||
|
||||
build_docker_image ${ImageName} ${RegistryService} ${ImageVersion} ${Project} ${ProjectVersion}
|
||||
}
|
||||
|
||||
|
||||
source ${BashFunctionCode}
|
||||
build_musvc_image ${ImageName} ${Project} ${ProjectVersion}
|
||||
|
||||
# echo "**** D E B U G E X I T" && exit
|
||||
echo "***** ${0} D O N E"
|
||||
|
||||
|
||||
16
trading_simulator/entrypoint.sh
Executable file
16
trading_simulator/entrypoint.sh
Executable file
@ -0,0 +1,16 @@
|
||||
#!/bin/bash
|
||||
|
||||
LogDir=/logs
|
||||
|
||||
Cmd="python3.12"
|
||||
Cmd+=" cvttpy/apps/trading_simulator/main.py"
|
||||
|
||||
Cmd+=" --config=${CONFIG_FILE:-/config/simulation.cfg}"
|
||||
Cmd+=" --simtime_file=${SIMTIME_FILE:-/data/simtime.bin}"
|
||||
Cmd+=" --cfgvar=DATA_DIR=/data"
|
||||
|
||||
Cmd+=" --log_file=${LogDir}/$TRDSIM_LOG_FILE:-%T.trading_simulator.log}"
|
||||
Cmd+=" ${TRDSIM_ADD_ARGS}"
|
||||
echo ${Cmd}
|
||||
exec ${Cmd}
|
||||
|
||||
9
trading_simulator/requirements.txt
Normal file
9
trading_simulator/requirements.txt
Normal file
@ -0,0 +1,9 @@
|
||||
aiohttp>=3.7.4.post0
|
||||
nest-asyncio>=1.5.5
|
||||
hjson>=3.1.0
|
||||
sortedcontainers>=2.4.0
|
||||
redis>=5.0.8
|
||||
python-dateutil>=2.8.2
|
||||
types-python-dateutil>=2.8.19.6
|
||||
cryptography>=43.0.0
|
||||
PyJWT>=2.10.1
|
||||
Loading…
x
Reference in New Issue
Block a user