63 lines
3.0 KiB
Docker
63 lines
3.0 KiB
Docker
# syntax=docker/dockerfile:1.6
|
|||
|
|
#
|
||
|
|
# Packages Conduit Market (github.com/Conduit-BTC/conduit-mono, apps/market)
|
||
|
|
# as a static Archipelago app. Conduit itself is a pure client-side SPA --
|
||
|
|
# products are Nostr events (NIP-99), orders are encrypted DMs, payments go
|
||
|
|
# over Lightning via NWC -- no custom backend, confirmed by reading
|
||
|
|
# packages/core/src/config.ts and apps/market/package.json directly rather
|
||
|
|
# than assumed. Upstream ships no Dockerfile; this one is new.
|
||
|
|
#
|
||
|
|
# Pinned to a specific upstream commit (not a moving branch) for
|
||
|
|
# reproducibility, matching the archy convention already used for
|
||
|
|
# apps/cuprate. Re-pin deliberately, not on every rebuild.
|
||
|
|
#
|
||
|
|
# oven/bun:1.1-slim is pinned to an EOL Debian bullseye base whose
|
||
|
|
# -security pool no longer serves the package versions it references
|
||
|
|
# (404s on ca-certificates/curl et al). oven/bun:1-slim currently resolves
|
||
|
|
# to bun 1.4.x on Debian trixie (current), so use that instead -- still a
|
||
|
|
# floating minor tag, but the alternative (hand-pinning a bullseye/bookworm
|
||
|
|
# digest) just reintroduces the same staleness problem later.
|
||
|
|
FROM oven/bun:1-slim AS build
|
||
|
|
|
||
|
|
ARG CONDUIT_COMMIT=c6606382dda8953763646f4498b2c4a4103da0a3
|
||
|
|
|
||
|
|
WORKDIR /build
|
||
|
|
RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates curl python3 \
|
||
|
|
&& rm -rf /var/lib/apt/lists/*
|
||
|
|
|
||
|
|
RUN curl -fsSL "https://github.com/Conduit-BTC/conduit-mono/archive/${CONDUIT_COMMIT}.tar.gz" \
|
||
|
|
-o /tmp/conduit.tar.gz \
|
||
|
|
&& tar xzf /tmp/conduit.tar.gz --strip-components=1 \
|
||
|
|
&& rm /tmp/conduit.tar.gz
|
||
|
|
|
||
|
|
# Full workspace install: apps/market depends on @conduit/core and
|
||
|
|
# @conduit/ui via workspace:*, so bun needs the whole monorepo present to
|
||
|
|
# link them, even though only the market app actually gets built below.
|
||
|
|
RUN bun install --frozen-lockfile
|
||
|
|
|
||
|
|
COPY apply-runtime-override.py /build/apply-runtime-override.py
|
||
|
|
RUN python3 apply-runtime-override.py
|
||
|
|
|
||
|
|
# Loads window.__CONDUIT_RUNTIME_ENV__ (written by docker-entrypoint.sh at
|
||
|
|
# container start) before the app bundle runs. A plain (non-module) script
|
||
|
|
# tag with an absolute path: Vite copies these through to dist/index.html
|
||
|
|
# verbatim without trying to resolve them as part of the module graph, and
|
||
|
|
# does not require the file to exist in the source tree at build time.
|
||
|
|
RUN sed -i 's#<script type="module" src="/src/main.tsx"></script>#<script src="/runtime-env.js"></script>\n <script type="module" src="/src/main.tsx"></script>#' \
|
||
|
|
apps/market/index.html
|
||
|
|
|
||
|
|
# Leave every VITE_* relay/network var unset here on purpose -- the runtime
|
||
|
|
# override (see above) is the actual public/private switch; baking any of
|
||
|
|
# these in at build time would defeat the point of a live-configurable
|
||
|
|
# single image.
|
||
|
|
RUN bun run --filter '@conduit/market' build
|
||
|
|
|
||
|
|
FROM nginx:1.27-alpine
|
||
|
|
|
||
|
|
COPY --from=build /build/apps/market/dist /usr/share/nginx/html
|
||
|
|
COPY nginx.conf /etc/nginx/conf.d/default.conf
|
||
|
|
COPY docker-entrypoint.sh /docker-entrypoint.d/50-conduit-runtime-env.sh
|
||
|
|
RUN chmod +x /docker-entrypoint.d/50-conduit-runtime-env.sh
|
||
|
|
|
||
|
|
EXPOSE 8080
|