mirror of
https://github.com/usetrmnl/trmnlp.git
synced 2026-08-13 14:27:33 -07:00
Necessary so a new plugin is immediately ready to push to GitHub and deploy on every commit to main. Init and clone now drop a CI workflow and .gitignore, and run `git init -b main` so the scaffold lands on the branch the workflow expects. The Docker image now includes git for the `docker run trmnl/trmnlp clone` flow. View templates ship canonical layout + title_bar markup. Use --skip-git to opt out.
73 lines
1.8 KiB
Docker
73 lines
1.8 KiB
Docker
ARG RUBY_VERSION=4.0.4
|
|
# ----- BUILD -----
|
|
|
|
# Pin the Debian suite explicitly (trixie) rather than letting `-slim` float
|
|
# to the next stable release — that keeps the apt-installed runtimes
|
|
# (imagemagick / python3 / nodejs / php-cli) on a known package archive
|
|
# instead of silently jumping a major version when Debian cuts a release.
|
|
FROM ruby:${RUBY_VERSION}-slim-trixie AS builder
|
|
|
|
WORKDIR /app
|
|
|
|
# Install build dependencies for C extensions
|
|
RUN apt-get update && \
|
|
apt-get install -y --no-install-recommends \
|
|
build-essential \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
RUN mkdir -p ./lib/trmnlp/
|
|
|
|
COPY Gemfile \
|
|
Gemfile.lock \
|
|
trmnl_preview.gemspec \
|
|
./
|
|
|
|
COPY /lib/ /app/lib/
|
|
|
|
RUN bundle install
|
|
|
|
# ----- RUN -----
|
|
|
|
FROM ruby:${RUBY_VERSION}-slim-trixie AS runner
|
|
|
|
# Install runtime dependencies.
|
|
# python3, nodejs, and php-cli are bundled so serverless transforms
|
|
# (lib/trmnlp/transform_backend/subprocess.rb) can shell out to the
|
|
# author's chosen runtime without a sidecar container. imagemagick on
|
|
# trixie ships IM7 (the `magick` binary trmnlp's PNG quantizer needs).
|
|
RUN apt-get update && \
|
|
apt-get install -y --no-install-recommends \
|
|
git \
|
|
imagemagick \
|
|
firefox-esr \
|
|
python3 \
|
|
nodejs \
|
|
php-cli \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
WORKDIR /app
|
|
|
|
# Copy installed gems from builder
|
|
COPY --from=builder /usr/local/bundle/ /usr/local/bundle/
|
|
|
|
COPY Gemfile \
|
|
Gemfile.lock \
|
|
trmnl_preview.gemspec \
|
|
LICENSE.txt \
|
|
README.md \
|
|
/app/
|
|
|
|
COPY lib/ /app/lib/
|
|
COPY web/ /app/web/
|
|
COPY bin/ /app/bin/
|
|
COPY templates/ /app/templates/
|
|
COPY db/ /app/db/
|
|
|
|
# Put trmnlp on PATH so it is callable as a bare command in an
|
|
# interactive shell, not only via the ENTRYPOINT.
|
|
RUN ln -s /app/bin/trmnlp /usr/local/bin/trmnlp
|
|
|
|
EXPOSE 4567
|
|
WORKDIR /plugin
|
|
ENTRYPOINT [ "/app/bin/trmnlp" ]
|