Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes port env vars in dockerfiles #93

Merged
merged 1 commit into from
Oct 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from typing import Annotated, Literal
from pydantic import AliasChoices, Field, HttpUrl
from typing import Literal

from pydantic import Field, HttpUrl
from pydantic_core import Url
from pydantic_settings import BaseSettings, SettingsConfigDict

Expand All @@ -16,30 +17,8 @@ class Settings(BaseSettings):
storage: FileStorageSettings = FileStorageSettings(root=".data/assistants")
logging: LoggingSettings = LoggingSettings()

workbench_service_url: Annotated[
HttpUrl,
Field(
# alias for backwards compatibility with older env vars
validation_alias=AliasChoices(
"assistant__workbench_service_url",
"ASSISTANT__WORKBENCH_SERVICE_URL",
"assistant__workbench_service_base_url",
"ASSISTANT__WORKBENCH_SERVICE_BASE_URL",
)
),
] = Url("http://127.0.0.1:3000")
workbench_service_api_key: Annotated[
str,
Field(
# alias for backwards compatibility with older env vars
validation_alias=AliasChoices(
"assistant__api_key",
"ASSISTANT__API_KEY",
"assistant__workbench_service_api_key",
"ASSISTANT__WORKBENCH_SERVICE_API_KEY",
)
),
] = ""
workbench_service_url: HttpUrl = Url("http://127.0.0.1:3000")
workbench_service_api_key: str = ""
workbench_service_ping_interval_seconds: float = 20.0

assistant_service_id: str | None = None
Expand All @@ -50,7 +29,7 @@ class Settings(BaseSettings):

protocol: Literal["http", "https"] = "http"
host: str = "127.0.0.1"
port: int = 3001
port: int = 0

website_protocol: str = Field(alias="WEBSITE_PROTOCOL", default="https")
website_port: int | None = Field(alias="WEBSITE_PORT", default=None)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ def main():
"--port",
dest="port",
type=int,
help="port to run service on; if not specified, a random port will be selected",
help="port to run service on; if not specified or 0, a random port will be selected",
default=settings.port,
)
parse_args.add_argument("--host", dest="host", type=str, default=settings.host, help="host IP to run service on")
parse_args.add_argument(
Expand Down
6 changes: 3 additions & 3 deletions tools/docker/Dockerfile.assistant
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ ENV PATH=/packages/assistants/assistant/.venv/bin:$PATH
COPY ./tools/docker/docker-entrypoint.sh /scripts/docker-entrypoint.sh
RUN chmod +x /scripts/docker-entrypoint.sh

ENV port=3001
ENV ASSISTANT_APP=${app}
ENV ASSISTANT__HOST=0.0.0.0
ENV ASSISTANT__PORT=${port}

ENV assistant__host=0.0.0.0
ENV assistant__port=3001

SHELL ["/bin/bash", "-c"]
ENTRYPOINT ["/scripts/docker-entrypoint.sh"]
Expand Down
3 changes: 2 additions & 1 deletion workbench-service/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ RUN chmod +x /scripts/docker-entrypoint.sh

WORKDIR /workbench-service

ENV WORKBENCH__SERVICE__HOST=0.0.0.0
ENV workbench__service__host=0.0.0.0
ENV workbench__service__port=3000

SHELL ["/bin/bash", "-c"]
ENTRYPOINT ["/scripts/docker-entrypoint.sh"]
Expand Down