52 lines
1.8 KiB
Docker
52 lines
1.8 KiB
Docker
ARG ZAMMAD_VERSION=6.5.2
|
|
|
|
FROM node:22-slim AS node
|
|
RUN npm install -g corepack && corepack enable pnpm
|
|
|
|
FROM zammad/zammad-docker-compose:${ZAMMAD_VERSION} AS builder
|
|
USER root
|
|
WORKDIR /opt/zammad
|
|
|
|
# Install Node.js and pnpm (needed for Vite/Sprockets asset compilation)
|
|
COPY --from=node /usr/local/bin/ /usr/local/bin/
|
|
COPY --from=node /usr/local/lib/node_modules/ /usr/local/lib/node_modules/
|
|
RUN pnpm install --frozen-lockfile
|
|
|
|
# Copy addon packages, install/setup scripts, and gems
|
|
RUN mkdir -p contrib/link/addons contrib/link/gems
|
|
COPY addons/ contrib/link/addons/
|
|
COPY setup.rb contrib/link/setup.rb
|
|
COPY install.rb contrib/link/install.rb
|
|
COPY gems/ contrib/link/gems/
|
|
|
|
# Install additional gems (proofmode for media verification)
|
|
RUN for gem in contrib/link/gems/*.gem; do \
|
|
[ -f "$gem" ] && gem install "$gem" --no-document || true; \
|
|
done
|
|
|
|
# Extract addon files from .zpm packages into Zammad directory tree
|
|
RUN ruby contrib/link/install.rb
|
|
|
|
# Precompile assets (includes addon CoffeeScript and Vue components)
|
|
RUN touch db/schema.rb && \
|
|
ZAMMAD_SAFE_MODE=1 DATABASE_URL=postgresql://zammad:/zammad \
|
|
bundle exec rake assets:precompile
|
|
|
|
# Clean up build artifacts
|
|
RUN rm -rf tmp/cache node_modules/.cache node_modules
|
|
|
|
# Inject addon registration into entrypoint (runs at container init when DB is available)
|
|
RUN sed -i '/^[[:space:]]*# es config/a\
|
|
echo "Installing addon packages..."\n\
|
|
bundle exec rails runner /opt/zammad/contrib/link/setup.rb\n\
|
|
bundle exec rake zammad:package:migrate\n\
|
|
' /docker-entrypoint.sh
|
|
|
|
FROM zammad/zammad-docker-compose:${ZAMMAD_VERSION}
|
|
USER root
|
|
|
|
COPY --from=builder --chown=zammad:zammad /opt/zammad/ /opt/zammad/
|
|
COPY --from=builder /docker-entrypoint.sh /docker-entrypoint.sh
|
|
COPY --from=builder /usr/local/bundle/ /usr/local/bundle/
|
|
|
|
USER zammad
|