Skip to content

Commit

Permalink
fix: check if we are running in a container
Browse files Browse the repository at this point in the history
  • Loading branch information
haatveit committed Feb 14, 2025
1 parent 441af5a commit 3d04188
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
1 change: 1 addition & 0 deletions containers/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ FROM base AS run

EXPOSE 3003
ENV FORCE_COLOR=1
ENV RUNNING_IN_CONTAINER=1

COPY --from=build /app /app

Expand Down
1 change: 1 addition & 0 deletions containers/alpine/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ FROM base AS run

EXPOSE 3003
ENV FORCE_COLOR=1
ENV RUNNING_IN_CONTAINER=1

COPY --from=build /app /app

Expand Down
9 changes: 8 additions & 1 deletion tsdfileapi/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def choose_storage(
opts: tornado.options.OptionParser,
directory: str,
) -> str:
if not directory.startswith("/tsd"):
if not directory.startswith("/tsd") or running_in_container():
return directory
split_on = "data/durable"
storage_path = find_tenant_storage_path(
Expand All @@ -106,6 +106,13 @@ def choose_storage(
return out_dir


def running_in_container() -> bool:
if os.getenv("RUNNING_IN_CONTAINER"):
return True
else:
return False


def call_request_hook(path: str, params: list, as_sudo: bool = True) -> None:
if as_sudo:
cmd = ["sudo"]
Expand Down

0 comments on commit 3d04188

Please sign in to comment.