Files
metabuilder/deployment/docker/Dockerfile.tools
johndoe6345789 2af4d04ab8 feat(deployment): Add comprehensive deployment components and scripts
- Introduced `README_ADDITIONS.md` for new services and features including CLI tools, system bootstrap, monitoring stack, and backup automation.
- Created Dockerfiles for CLI and admin tools, enabling standalone usage and administrative tasks.
- Implemented `docker-compose.monitoring.yml` for Prometheus, Grafana, Loki, and related services for monitoring and observability.
- Added `backup-database.sh` for automated PostgreSQL backups with retention policies.
- Developed `bootstrap-system.sh` for initializing the system, running migrations, and seeding the database.
- Updated `deploy.sh` for streamlined deployment across development, production, and monitoring environments.
- Configured Prometheus and Grafana with appropriate datasource and scrape configurations.
- Enhanced directory structure for better organization of deployment files and scripts.
2026-01-03 19:33:05 +00:00

93 lines
2.2 KiB
Docker

# MetaBuilder Tools/Admin Container
# Includes CLI, migrations, seed scripts, and administrative tools
# Build: docker build -f deployment/docker/Dockerfile.tools -t metabuilder-tools .
# Run: docker run -it --rm --network metabuilder_network metabuilder-tools
FROM node:20-alpine AS node-builder
WORKDIR /build
# Copy frontend for migration tools
COPY frontends/nextjs/package*.json ./frontends/nextjs/
RUN cd frontends/nextjs && npm ci
COPY frontends/nextjs/ ./frontends/nextjs/
COPY prisma/ ./prisma/
# Build Prisma client
RUN cd frontends/nextjs && npx prisma generate
# === CLI Builder ===
FROM ubuntu:22.04 AS cli-builder
RUN apt-get update && apt-get install -y \
build-essential \
cmake \
ninja-build \
python3 \
python3-pip \
git \
curl \
&& rm -rf /var/lib/apt/lists/*
RUN pip3 install --no-cache-dir conan
RUN conan profile detect --force
WORKDIR /build
COPY frontends/cli/ ./cli/
WORKDIR /build/cli
RUN conan install . --output-folder build --build missing --settings=build_type=Release
RUN cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=build/conan_toolchain.cmake
RUN cmake --build build --config Release
# === Final Tools Image ===
FROM node:20-alpine
# Install additional tools
RUN apk add --no-cache \
postgresql-client \
curl \
jq \
bash \
libcurl \
ca-certificates
# Create app user
RUN adduser -D -s /bin/bash metabuilder
WORKDIR /app
# Copy Node.js tools and Prisma
COPY --from=node-builder /build/frontends/nextjs /app/nextjs
COPY --from=node-builder /build/prisma /app/prisma
# Copy CLI binary
COPY --from=cli-builder /build/cli/build/bin/metabuilder-cli /usr/local/bin/metabuilder-cli
RUN chmod +x /usr/local/bin/metabuilder-cli
# Copy seed data and scripts
COPY seed/ /app/seed/
COPY deployment/scripts/ /app/scripts/
RUN chmod +x /app/scripts/*.sh
# Copy packages
COPY packages/ /app/packages/
# Set ownership
RUN chown -R metabuilder:metabuilder /app
USER metabuilder
# Environment variables
ENV METABUILDER_BASE_URL=http://metabuilder-app:3000
ENV METABUILDER_PACKAGES=/app/packages
ENV DBAL_API_URL=http://dbal-daemon:8080
ENV NODE_ENV=production
WORKDIR /app
# Default to interactive shell
CMD ["/bin/bash"]