iuna

iuna - experimental devnet protocol
git clone https://iuna.jhx.app/git/iuna.git
Log | Files | Refs | README | LICENSE

Dockerfile (3379B)


      1 # syntax=docker/dockerfile:1
      2 
      3 ########################################################################
      4 # 1. Build stagit - static git page generator (log/commits/files/refs).
      5 #    Low-resource on purpose: once generated, serving is plain static
      6 #    files, no git process or CGI running at request time.
      7 ########################################################################
      8 FROM debian:bookworm-slim AS stagit-builder
      9 
     10 RUN apt-get update && apt-get install -y --no-install-recommends \
     11         build-essential \
     12         pkg-config \
     13         libgit2-dev \
     14         git \
     15         ca-certificates \
     16     && rm -rf /var/lib/apt/lists/*
     17 
     18 RUN git clone --depth 1 https://github.com/oxalorg/stagit.git /usr/src/stagit
     19 WORKDIR /usr/src/stagit
     20 RUN make PREFIX=/usr/local && make PREFIX=/usr/local install
     21 
     22 ########################################################################
     23 # 2. Generate the site: HTML browser pages + a clonable bare repo.
     24 #
     25 #    The build context must include .git. The .dockerignore in this repo
     26 #    keeps it available so stagit can publish history and refs.
     27 ########################################################################
     28 FROM stagit-builder AS site-builder
     29 
     30 COPY . /src/iuna-work
     31 
     32 RUN set -eux; \
     33     test -d /src/iuna-work/.git; \
     34     git clone --bare /src/iuna-work /src/iuna.git; \
     35     mkdir -p /site/git/iuna /var/cache/stagit-iuna; \
     36     echo "iuna - experimental devnet protocol" > /src/iuna.git/description; \
     37     echo "iuna-labs" > /src/iuna.git/owner; \
     38     echo "https://iuna.jhx.app/git/iuna.git" > /src/iuna.git/url; \
     39     cd /src/iuna.git; \
     40     mkdir -p /tmp/iuna-packs; \
     41     mv objects/pack/* /tmp/iuna-packs/; \
     42     for pack in /tmp/iuna-packs/*.pack; do \
     43         [ -e "$pack" ] || continue; \
     44         git unpack-objects < "$pack"; \
     45     done; \
     46     rm -rf /tmp/iuna-packs; \
     47     git update-server-info; \
     48     cd /site/git/iuna; \
     49     stagit -c /var/cache/stagit-iuna/cache /src/iuna.git; \
     50     test -f /site/git/iuna/log.html; \
     51     cp /site/git/iuna/log.html /site/git/iuna/index.html; \
     52     cd /site/git && stagit-index /src/iuna.git > index.html; \
     53     cp /src/iuna-work/www/assets/static-listing.css /site/git/style.css; \
     54     cp /src/iuna-work/www/assets/static-listing.css /site/git/iuna/style.css; \
     55     cp /src/iuna-work/src-tauri/icons/32x32.png /site/git/logo.png; \
     56     cp /src/iuna-work/src-tauri/icons/32x32.png /site/git/iuna/logo.png; \
     57     cp -a /src/iuna.git /site/git/iuna.git; \
     58     find /site/git -type f -name '*.html' -exec sed -i -E 's|<a href="(\.\./)+"><img |<a href="/"><img |g' {} +
     59 
     60 COPY www /site
     61 COPY downloads /site/downloads
     62 RUN set -eux; \
     63     version="$(sed -n 's/^version = "\(.*\)"/\1/p' /src/iuna-work/Cargo.toml | head -n 1)"; \
     64     mkdir -p /site/downloads; \
     65     cp /site/downloads.html /site/downloads/index.html; \
     66     sed -i "s|\${IUNA_VERSION}|${version}|g" /site/downloads/index.html; \
     67     printf '{"tag":"v%s","version":"%s","url":"https://iuna.jhx.app/downloads/"}\n' "$version" "$version" > /site/downloads/latest.json; \
     68     rm -f /site/downloads.html
     69 
     70 ########################################################################
     71 # 3. Ship it - plain nginx, static files only.
     72 ########################################################################
     73 FROM nginx:1.27-alpine
     74 
     75 COPY --from=site-builder /site /usr/share/nginx/html
     76 COPY nginx.conf /etc/nginx/conf.d/default.conf
     77 
     78 EXPOSE 80