fix: mount custom.css to assets directory, not css

static_paths only includes: assets, fonts, images, js
The css directory is NOT served by Phoenix.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-11-09 09:55:58 +01:00
parent 60e118be31
commit b3bffd8ba8
3 changed files with 28 additions and 2 deletions

26
asciinema/Dockerfile Normal file
View File

@@ -0,0 +1,26 @@
FROM ghcr.io/asciinema/asciinema-server:latest AS base
# Download the source to find and patch the template
FROM elixir:1.18-alpine AS builder
# Install git and build dependencies
RUN apk add --no-cache git build-base nodejs npm
# Clone the asciinema-server repository
WORKDIR /app
RUN git clone https://github.com/asciinema/asciinema-server.git .
RUN git checkout v1.0.0
# Patch the layout template to inject custom theme
RUN sed -i '/<\/head>/i\ <!-- Custom Pivoine Rose Theme -->\n <link rel="stylesheet" href="/theme/custom.css" />\n <link rel="icon" type="image/svg+xml" href="/theme/favicon.svg" />' \
lib/asciinema_web/templates/layout/app.html.heex
# Build the release
RUN mix local.hex --force && \
mix local.rebar --force && \
mix deps.get --only prod && \
MIX_ENV=prod mix do compile, assets.deploy, release
# Final image: copy the patched release over the base image
FROM base
COPY --from=builder /app/_build/prod/rel/asciinema /opt/app/

View File

@@ -8,7 +8,7 @@ services:
volumes: volumes:
- asciinema_data:/var/opt/asciinema - asciinema_data:/var/opt/asciinema
- ./custom.exs:/opt/app/etc/custom.exs:ro - ./custom.exs:/opt/app/etc/custom.exs:ro
- ./theme/custom.css:/opt/app/lib/asciinema-1.0.0/priv/static/css/custom.css:ro - ./theme/custom.css:/opt/app/lib/asciinema-1.0.0/priv/static/assets/custom.css:ro
- ./theme/favicon.svg:/opt/app/lib/asciinema-1.0.0/priv/static/images/favicon-custom.svg:ro - ./theme/favicon.svg:/opt/app/lib/asciinema-1.0.0/priv/static/images/favicon-custom.svg:ro
- ./theme/custom.js:/opt/app/lib/asciinema-1.0.0/priv/static/js/custom.js:ro - ./theme/custom.js:/opt/app/lib/asciinema-1.0.0/priv/static/js/custom.js:ro
environment: environment:

View File

@@ -3,7 +3,7 @@
// Inject custom CSS // Inject custom CSS
var customCSS = document.createElement('link'); var customCSS = document.createElement('link');
customCSS.rel = 'stylesheet'; customCSS.rel = 'stylesheet';
customCSS.href = '/css/custom.css'; customCSS.href = '/assets/custom.css';
document.head.appendChild(customCSS); document.head.appendChild(customCSS);
// Inject custom favicon // Inject custom favicon