diff --git a/.gitignore b/.gitignore index 68bef0b..bdf2813 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,5 @@ __pycache__/ *.*swp* docker-compose.yml dist/ +node_modules/ +yarn*.log diff --git a/Dockerfile b/Dockerfile index 34a502d..c48fc11 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,17 +2,19 @@ FROM python:3.8-alpine RUN adduser -S fabcal -RUN apk add --no-cache build-base libuv-dev libffi-dev && \ - pip3 install poetry +RUN apk add --no-cache build-base libuv-dev libffi-dev yarn && \ + pip3 install -U poetry + +RUN install -d -o fabcal /app USER fabcal -COPY poetry.lock pyproject.toml /app/ +COPY poetry.lock pyproject.toml package.json yarn.lock /app/ WORKDIR /app/ -RUN pip install -U poetry && \ - poetry install --only main +RUN poetry install --only main && \ + yarn install COPY fabcal /app/fabcal/ COPY static/ /app/static/ diff --git a/fabcal/app.py b/fabcal/app.py index d172c12..61a8ff0 100644 --- a/fabcal/app.py +++ b/fabcal/app.py @@ -13,6 +13,9 @@ app = FastAPI() app.mount("/static", StaticFiles(directory="static"), name="static") +for framework in ["normalize.css", "milligram", "@fortawesome/fontawesome-free"]: + app.mount(f"/assets/{framework}", StaticFiles(directory=f"node_modules/{framework}"), name=framework) + app.include_router(api_v1.router, prefix="/api/v1") app.include_router(frontend.router, prefix="") diff --git a/package.json b/package.json new file mode 100644 index 0000000..207c77a --- /dev/null +++ b/package.json @@ -0,0 +1,10 @@ +{ + "name": "fabcal", + "version": "0.0.1", + "author": "Fabian Müller ", + "license": "MIT", + "dependencies": { + "@fortawesome/fontawesome-free": "^6.2.1", + "milligram": "^1.4.1" + } +} diff --git a/templates/sidebar/base.html b/templates/sidebar/base.html index b12549b..63381f9 100644 --- a/templates/sidebar/base.html +++ b/templates/sidebar/base.html @@ -2,10 +2,9 @@ {% block header %} - {#- TODO: replace with locally served files #} - - - + + + diff --git a/templates/sidebar/embed.html b/templates/sidebar/embed.html index afdc142..1aa912c 100644 --- a/templates/sidebar/embed.html +++ b/templates/sidebar/embed.html @@ -1,10 +1,9 @@ - {#- TODO: replace with locally served files #} - - - + + + diff --git a/yarn.lock b/yarn.lock new file mode 100644 index 0000000..f09e9d5 --- /dev/null +++ b/yarn.lock @@ -0,0 +1,20 @@ +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. +# yarn lockfile v1 + + +"@fortawesome/fontawesome-free@^6.2.1": + version "6.2.1" + resolved "https://registry.yarnpkg.com/@fortawesome/fontawesome-free/-/fontawesome-free-6.2.1.tgz#344baf6ff9eaad7a73cff067d8c56bfc11ae5304" + integrity sha512-viouXhegu/TjkvYQoiRZK3aax69dGXxgEjpvZW81wIJdxm5Fnvp3VVIP4VHKqX4SvFw6qpmkILkD4RJWAdrt7A== + +milligram@^1.4.1: + version "1.4.1" + resolved "https://registry.yarnpkg.com/milligram/-/milligram-1.4.1.tgz#6c8c781541b0d994ccca784c60f0aca1f7104b42" + integrity sha512-RCgh/boHhcXWOUfKJWm3RJRoUeaEguoipDg0mJ31G0tFfvcpWMUlO1Zlqqr12K4kAXfDlllaidu0x7PaL2PTFg== + dependencies: + normalize.css "~8.0.1" + +normalize.css@~8.0.1: + version "8.0.1" + resolved "https://registry.yarnpkg.com/normalize.css/-/normalize.css-8.0.1.tgz#9b98a208738b9cc2634caacbc42d131c97487bf3" + integrity sha512-qizSNPO93t1YUuUhP22btGOo3chcvDFqFaj2TRybP0DMxkHOCTYwp3n34fel4a31ORXy4m1Xq0Gyqpb5m33qIg==