From 42854250511567ab352239b611752281e78dcac3 Mon Sep 17 00:00:00 2001 From: len0rd Date: Sat, 27 May 2023 23:41:55 -0400 Subject: [PATCH] fixes/updates. use pydata theme. use drawio extension in devcontainer --- .devcontainer/devcontainer.json | 7 +++++ Dockerfile | 42 ++++++++++++++++-------------- assets/diagrams/hal_concept.drawio | 2 +- conf.py | 24 +++++++---------- pip-requirements.txt | 4 +-- posts/embedded_dev_primer.rst | 4 +-- 6 files changed, 45 insertions(+), 38 deletions(-) create mode 100644 .devcontainer/devcontainer.json diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 0000000..934cd79 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,7 @@ +{ + "build": { + "context": "../", + "dockerfile": "../Dockerfile" + }, + "forwardPorts": [8090] +} diff --git a/Dockerfile b/Dockerfile index bebc357..17e457d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,25 +1,29 @@ -FROM node:14-alpine +FROM python:3.11-bullseye -# Create app directory -WORKDIR /usr/src/app +ADD pip-requirements.txt /tmp/pip-requirements.txt +RUN pip install -r /tmp/pip-requirements.txt \ + && rm /tmp/pip-requirements.txt -# Install app dependencies -# A wildcard is used to ensure both package.json AND package-lock.json are copied -# where available (npm@5+) -COPY package*.json ./ - -RUN npm install - -RUN apk add --no-cache python3 bash \ - && ln -sf python3 /usr/bin/python +# install drawio for doc diagram gen +ENV DRAWIO_VERSION "21.1.2" +RUN apt update \ + && apt install -yq --no-install-recommends \ + xvfb \ + wget \ + libnotify4 \ + libgbm1 \ + libasound2 \ + libxss1 \ + libsecret-1-0 \ + && wget https://github.com/jgraph/drawio-desktop/releases/download/v${DRAWIO_VERSION}/drawio-amd64-${DRAWIO_VERSION}.deb \ + && apt install -y ./drawio-amd64-${DRAWIO_VERSION}.deb \ + && rm -rf /var/lib/apt/lists/* \ + && rm -rf drawio-amd64-${DRAWIO_VERSION}.deb +ENV XVFB_DISPLAY ":42" # Bundle app source -COPY . . - -RUN python3 -m ensurepip \ - && pip3 install --no-cache --upgrade pip setuptools \ - && pip3 install -r pip-requirements.txt +# COPY . . +# RUN ablog build EXPOSE 8090 - -CMD [ "npm", "start" ] +CMD [ "ablog", "serve", "-p", "8090" ] diff --git a/assets/diagrams/hal_concept.drawio b/assets/diagrams/hal_concept.drawio index 1aa83df..56cedb2 100644 --- a/assets/diagrams/hal_concept.drawio +++ b/assets/diagrams/hal_concept.drawio @@ -1,6 +1,6 @@ - + diff --git a/conf.py b/conf.py index fde1e27..d4c71fe 100644 --- a/conf.py +++ b/conf.py @@ -10,6 +10,7 @@ extensions = [ "ablog", "sphinx.ext.intersphinx", "sphinx_design", + "sphinxcontrib.drawio", ] html_static_path = ["_static"] @@ -26,34 +27,29 @@ fontawesome_included = True html_baseurl = blog_baseurl html_title = blog_title -html_theme = "sphinx_book_theme" +html_theme = "pydata_sphinx_theme" html_theme_options = { - "repository_url": "https://github.com/len0rd/", "search_bar_text": "search ...", "show_prev_next": False, "navbar_center": [], - "use_fullscreen_button": False, - "use_repository_button": True, - # "footer_items": ["copyright", "sphinx-version", x"last-updated"], } html_favicon = "assets/img/favicon.ico" html_sidebars = { "*": [ - "sitename.html", - "search-field.html", - "recentposts.html", - "archives.html", + "ablog/recentposts.html", + "ablog/archives.html", ], "posts/**": [ - "sitename.html", - "search-field.html", - "postcard.html", - "recentposts.html", - "archives.html", + "ablog/postcard.html", + "ablog/recentposts.html", + "ablog/archives.html", ], } html_context = {"html_title": html_title} pygments_style = "sas" + +drawio_headless = True +drawio_no_sandbox = True diff --git a/pip-requirements.txt b/pip-requirements.txt index c2b7e31..83f9f09 100644 --- a/pip-requirements.txt +++ b/pip-requirements.txt @@ -1,6 +1,6 @@ sphinx ablog sphinx-design -pydata_sphinx_theme sphinxcontrib-youtube -sphinx-book-theme +pydata-sphinx-theme +sphinxcontrib-drawio diff --git a/posts/embedded_dev_primer.rst b/posts/embedded_dev_primer.rst index bc036f1..751bb12 100644 --- a/posts/embedded_dev_primer.rst +++ b/posts/embedded_dev_primer.rst @@ -84,7 +84,7 @@ Making unit-testable code in embedded development can be challenging. There is a What does that look like? Something like this: -.. image:: ../assets/img/writeup/embedded_dev_primer/hal_concept.svg +.. drawio-image:: ../assets/diagrams/hal_concept.drawio Notice all SOC/MCU-specific code is encapsulated down in a single library which we abstract out with an interface layer immediately. @@ -107,7 +107,7 @@ What are "board-specifics"? This is the term I use to describe the configuration Here's an extension of the earlier diagram with these concepts added: -.. image:: ../assets/img/writeup/embedded_dev_primer/hal_concept_with_board.svg +.. drawio-image:: ../assets/diagrams/hal_concept_with_board.drawio Benefits: