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\ \n \n ' \
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/