link-stack/docker/zammad/Dockerfile

53 lines
1.8 KiB
Text
Raw Normal View History

2026-02-15 19:34:12 +01:00
ARG ZAMMAD_VERSION=6.5.2
2024-05-09 07:42:44 +02:00
2026-02-15 19:34:12 +01:00
FROM node:22-slim AS node
RUN npm install -g corepack && corepack enable pnpm
2026-02-15 19:34:12 +01:00
FROM zammad/zammad-docker-compose:${ZAMMAD_VERSION} AS builder
USER root
2026-02-13 21:04:36 +01:00
WORKDIR /opt/zammad
2026-02-15 19:34:12 +01:00
# 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
2026-02-15 19:34:12 +01:00
# 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/
2026-02-15 19:34:12 +01:00
# 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
2026-02-15 19:34:12 +01:00
# Extract addon files from .zpm packages into Zammad directory tree
RUN ruby contrib/link/install.rb
2026-02-13 21:04:36 +01:00
2026-02-15 19:34:12 +01:00
# Precompile assets (includes addon CoffeeScript and Vue components)
RUN touch db/schema.rb && \
2026-02-15 19:34:12 +01:00
ZAMMAD_SAFE_MODE=1 DATABASE_URL=postgresql://zammad:/zammad \
bundle exec rake assets:precompile
2026-02-15 19:34:12 +01:00
# Clean up build artifacts
RUN rm -rf tmp/cache node_modules/.cache node_modules
2025-11-22 10:56:13 +01:00
2026-02-15 19:34:12 +01:00
# Inject addon registration into entrypoint (runs at container init when DB is available)
2025-11-22 10:56:13 +01:00
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\
2026-02-15 19:34:12 +01:00
' /docker-entrypoint.sh
2026-02-13 21:04:36 +01:00
2026-02-15 19:34:12 +01:00
FROM zammad/zammad-docker-compose:${ZAMMAD_VERSION}
USER root
2026-02-13 21:04:36 +01:00
2026-02-15 19:34:12 +01:00
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/
2026-02-13 21:04:36 +01:00
2026-02-15 19:34:12 +01:00
USER zammad