From 56f799266bf7fcac3316784b5a93fb31ebe7c64e Mon Sep 17 00:00:00 2001 From: Timothy Pidashev Date: Mon, 11 Mar 2024 14:20:55 -0700 Subject: [PATCH] Shared dirs almost ready :D --- Makefile | 10 ++++++++++ compose.dev.yml | 3 +++ src/landing/Dockerfile.dev | 3 +-- src/landing/landing/components/__init__.py | 2 +- src/landing/landing/pages/__init__.py | 2 +- src/landing/landing/templates/webpage.py | 2 +- src/shared/components/__init__.py | 1 + src/shared/components/keep | 0 src/{landing/landing => shared}/components/navbar.py | 0 src/shared/pages/__init__.py | 1 + src/shared/pages/keep | 0 src/{landing/landing => shared}/pages/page404.py | 0 src/shared/state/keep | 0 src/shared/templates/keep | 0 14 files changed, 19 insertions(+), 5 deletions(-) create mode 100644 src/shared/components/__init__.py delete mode 100644 src/shared/components/keep rename src/{landing/landing => shared}/components/navbar.py (100%) create mode 100644 src/shared/pages/__init__.py delete mode 100644 src/shared/pages/keep rename src/{landing/landing => shared}/pages/page404.py (100%) delete mode 100644 src/shared/state/keep delete mode 100644 src/shared/templates/keep diff --git a/Makefile b/Makefile index 0f7ba7d..0b822b8 100644 --- a/Makefile +++ b/Makefile @@ -147,7 +147,9 @@ define container_build $(eval TAG := $(PROJECT_REGISTRY)/$(CONTAINER):$(VERSION)), \ ) + sudo mount -o bind src/shared src/landing/landing/shared docker buildx build --load -t $(TAG) -f $(strip $(subst $(SPACE),,$(call container_location,$(CONTAINER))))/Dockerfile.$(ENVIRONMENT) ./$(strip $(subst $(SPACE),,$(call container_location,$(CONTAINER))))/. $(ARGS) $(call labels,$(shell echo $(CONTAINER_NAME) | tr '[:lower:]' '[:upper:]')) --no-cache + sudo umount /src/landing/landing/shared endef define container_location @@ -161,3 +163,11 @@ define container_version $(shell echo $(strip $(strip $(CONTAINER_$(CONTAINER_NAME)_VERSION))) | tr -d '[:space:]'), \ $(error Version data for container $(1) not found)) endef + +define mount_shared + $(sudo mount -o bind src/shared src/landing/landing/shared) +endef + +define unmount_shared + $(sudo umount src/shared) +endef diff --git a/compose.dev.yml b/compose.dev.yml index 93289a5..971c0ce 100644 --- a/compose.dev.yml +++ b/compose.dev.yml @@ -23,6 +23,7 @@ services: - ./src/landing/landing:/app/landing - ./src/landing/assets:/app/assets - ./src/landing/rxconfig.py:/app/rxconfig.py + - ./src/shared:/app/landing/shared networks: - caddy @@ -33,9 +34,11 @@ services: - ./src/about/about:/app/about - ./src/about/assets:/app/assets - ./src/about/rxconfig.py:/app/rxconfig.py + - ./src/shared:/app/about/shared networks: - caddy + networks: caddy: name: caddy diff --git a/src/landing/Dockerfile.dev b/src/landing/Dockerfile.dev index f5c6b24..d1cf3a2 100644 --- a/src/landing/Dockerfile.dev +++ b/src/landing/Dockerfile.dev @@ -25,7 +25,7 @@ RUN mv .web/_static /tmp/_static RUN rm -rf .web && mkdir .web RUN mv /tmp/_static .web/_static -# Stage 2: copy artifacts into slim image +# Stage 2: copy artifacts into slim image FROM python:3.11-slim WORKDIR /app RUN adduser --disabled-password --home /app reflex @@ -51,4 +51,3 @@ RUN /app/.venv/bin/pip install -r /app/requirements.txt # The following lines are for the specific command for the application. CMD reflex init && reflex run --env dev - diff --git a/src/landing/landing/components/__init__.py b/src/landing/landing/components/__init__.py index a830f66..994f7d0 100644 --- a/src/landing/landing/components/__init__.py +++ b/src/landing/landing/components/__init__.py @@ -1,2 +1,2 @@ -from .navbar import navbar +from landing.shared.components import navbar from .footer import footer diff --git a/src/landing/landing/pages/__init__.py b/src/landing/landing/pages/__init__.py index d0e5966..fc95cdc 100644 --- a/src/landing/landing/pages/__init__.py +++ b/src/landing/landing/pages/__init__.py @@ -1,7 +1,7 @@ from landing.route import Route from .index import index -from .page404 import page404 +from landing.shared.pages import page404 routes = [ *[r for r in locals().values() if isinstance(r, Route)], diff --git a/src/landing/landing/templates/webpage.py b/src/landing/landing/templates/webpage.py index ce6fb1d..1c46e31 100644 --- a/src/landing/landing/templates/webpage.py +++ b/src/landing/landing/templates/webpage.py @@ -36,7 +36,7 @@ def webpage(path: str, title: str = "Timothy Pidashev", props=None) -> Callable: The component with the template applied. """ # Import here to avoid circular imports. - from landing.components.navbar import navbar + from landing.shared.components.navbar import navbar from landing.components.footer import footer # Wrap the component in the template. diff --git a/src/shared/components/__init__.py b/src/shared/components/__init__.py new file mode 100644 index 0000000..aa6cfd2 --- /dev/null +++ b/src/shared/components/__init__.py @@ -0,0 +1 @@ +from .navbar import navbar diff --git a/src/shared/components/keep b/src/shared/components/keep deleted file mode 100644 index e69de29..0000000 diff --git a/src/landing/landing/components/navbar.py b/src/shared/components/navbar.py similarity index 100% rename from src/landing/landing/components/navbar.py rename to src/shared/components/navbar.py diff --git a/src/shared/pages/__init__.py b/src/shared/pages/__init__.py new file mode 100644 index 0000000..895ac1f --- /dev/null +++ b/src/shared/pages/__init__.py @@ -0,0 +1 @@ +from .page404 import page404 diff --git a/src/shared/pages/keep b/src/shared/pages/keep deleted file mode 100644 index e69de29..0000000 diff --git a/src/landing/landing/pages/page404.py b/src/shared/pages/page404.py similarity index 100% rename from src/landing/landing/pages/page404.py rename to src/shared/pages/page404.py diff --git a/src/shared/state/keep b/src/shared/state/keep deleted file mode 100644 index e69de29..0000000 diff --git a/src/shared/templates/keep b/src/shared/templates/keep deleted file mode 100644 index e69de29..0000000