Skip to content

Commit aa84a1c

Browse files
authored
fix(cli): align timezone between host and model container (#247)
Because - misalign timezone between host and model container when executing `run` This commit - align timezone between host and model container by mounting timezone configs
1 parent d08cf37 commit aa84a1c

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

instill/helpers/cli.py

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,10 @@ def run(args):
292292
"--shm-size=4gb",
293293
"--name",
294294
str(name),
295+
"-v",
296+
"/etc/timezone:/etc/timezone:ro",
297+
"-v",
298+
"/etc/localtime:/etc/localtime:ro",
295299
f"{args.name}:{args.tag}",
296300
"serve",
297301
"run",
@@ -302,11 +306,14 @@ def run(args):
302306
)
303307
else:
304308
subprocess.run(
305-
f"docker run --rm -d --shm-size=4gb --name {str(name)} --gpus all {args.name}:{args.tag} /bin/bash -c \
306-
\"serve build _model:entrypoint -o serve.yaml && \
307-
sed -i 's/app1/default/' serve.yaml && \
308-
sed -i 's/num_cpus: 0.0/num_gpus: 1.0/' serve.yaml && \
309-
serve run serve.yaml\"",
309+
f"docker run \
310+
--rm -d --shm-size=4gb --name {str(name)} --gpus all \
311+
-v /etc/timezone:/etc/timezone:ro -v /etc/localtime:/etc/localtime:ro \
312+
{args.name}:{args.tag} /bin/bash -c \
313+
\"serve build _model:entrypoint -o serve.yaml && \
314+
sed -i 's/app1/default/' serve.yaml && \
315+
sed -i 's/num_cpus: 0.0/num_gpus: 1.0/' serve.yaml && \
316+
serve run serve.yaml\"",
310317
shell=True,
311318
check=True,
312319
stdout=subprocess.DEVNULL,

instill/helpers/init-templates/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ ARG TARGET_ARCH_SUFFIX
66

77
FROM rayproject/ray:${RAY_VERSION}-py${PYTHON_VERSION}${CUDA_SUFFIX}${TARGET_ARCH_SUFFIX}
88

9-
RUN sudo apt-get update && sudo apt-get install curl -y
9+
RUN sudo apt-get update && sudo apt-get install tzdata curl vim -y
1010

1111
ARG SYSTEM_PACKAGES
1212
RUN for package in ${SYSTEM_PACKAGES}; do \

0 commit comments

Comments
 (0)