diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..0836d72 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,21 @@ +node_modules/ +.git/ +.gitignore +.gitattributes +*.md +.editorconfig +.prettierrc +.prettierignore +eslint.config.mjs +.env +.env* +tests/ +content/ +docs/ +web/landing/ +web/docs/ +vitest.config.ts +*.tsbuildinfo +.next/ +dist/ +.astro/ diff --git a/.github/workflows/build-image.yml b/.github/workflows/build-image.yml new file mode 100644 index 0000000..cd22f39 --- /dev/null +++ b/.github/workflows/build-image.yml @@ -0,0 +1,65 @@ +name: Build Docker Image + +on: + push: + branches: [master] + tags: ["v*"] + paths-ignore: + - 'web/docs/**' + - 'web/landing/**' + - 'content/**' + - 'README.md' + - 'CONTRIBUTING.md' + - '.github/workflows/deploy-docs.yml' + pull_request: + branches: [master] + paths-ignore: + - 'web/docs/**' + - 'web/landing/**' + - 'content/**' + - '*.md' + workflow_dispatch: + +jobs: + build: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + + steps: + - uses: actions/checkout@v4 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Log in to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Extract metadata for Docker + id: meta + uses: docker/metadata-action@v5 + with: + images: ghcr.io/${{ github.repository }}/omnia-gui + tags: | + type=ref,event=branch + type=ref,event=pr + type=semver,pattern={{version}} + type=semver,pattern={{major}}.{{minor}} + type=sha,format=short + + - name: Build and push Docker image + uses: docker/build-push-action@v6 + with: + context: . + file: apps/gui/Dockerfile + push: ${{ github.event_name != 'pull_request' }} + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + cache-from: type=gha + cache-to: type=gha,mode=max + provenance: false diff --git a/apps/gui/Dockerfile b/apps/gui/Dockerfile new file mode 100644 index 0000000..dcd9fa3 --- /dev/null +++ b/apps/gui/Dockerfile @@ -0,0 +1,59 @@ +FROM node:22-slim AS base +ENV PNPM_HOME="/pnpm" \ + PATH="$PNPM_HOME:$PATH" +RUN corepack enable && corepack prepare pnpm@11.13.0 --activate +WORKDIR /app + +FROM base AS build-deps +RUN apt-get update -qq && \ + apt-get install -qq -y --no-install-recommends \ + python3 make g++ && \ + rm -rf /var/lib/apt/lists/* + +COPY pnpm-lock.yaml pnpm-workspace.yaml ./ +COPY package.json tsconfig.json tsconfig.base.json ./ +COPY apps/gui/package.json apps/gui/package.json +COPY apps/gui/tsconfig.json apps/gui/tsconfig.json +COPY apps/gui/next.config.ts apps/gui/next.config.ts +COPY apps/gui/postcss.config.mjs apps/gui/postcss.config.mjs +COPY apps/gui/components.json apps/gui/components.json +COPY packages/actor/package.json packages/actor/package.json +COPY packages/architect/package.json packages/architect/package.json +COPY packages/core/package.json packages/core/package.json +COPY packages/intent/package.json packages/intent/package.json +COPY packages/llm/package.json packages/llm/package.json +COPY packages/memory/package.json packages/memory/package.json +COPY packages/scenario/package.json packages/scenario/package.json +COPY packages/spatial/package.json packages/spatial/package.json +RUN --mount=type=cache,id=pnpm,target=/pnpm/store \ + pnpm install --frozen-lockfile + +FROM build-deps AS pkg-builder +COPY packages/ ./packages/ +RUN pnpm build + +FROM pkg-builder AS gui-builder +COPY apps/gui/src ./apps/gui/src +COPY apps/gui/public ./apps/gui/public +RUN pnpm --filter @omnia/gui build + +FROM base AS runner +ENV NODE_ENV=production +RUN apt-get update -qq && \ + apt-get install -qq -y --no-install-recommends \ + python3 make g++ && \ + rm -rf /var/lib/apt/lists/* + +COPY --from=gui-builder /app/package.json /app/pnpm-workspace.yaml ./ +COPY --from=gui-builder /app/node_modules ./node_modules +COPY --from=gui-builder /app/packages ./packages +COPY --from=gui-builder /app/apps/gui/package.json \ + /app/apps/gui/next.config.ts \ + /app/apps/gui/postcss.config.mjs \ + ./apps/gui/ +COPY --from=gui-builder /app/apps/gui/.next ./apps/gui/.next +COPY --from=gui-builder /app/apps/gui/public ./apps/gui/public + +WORKDIR /app/apps/gui +EXPOSE 3000 +CMD ["pnpm", "start"] diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..9255e35 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,15 @@ +services: + omnia-gui: + build: + context: . + dockerfile: apps/gui/Dockerfile + ports: + - "3000:3000" + environment: + - NODE_ENV=production + - GOOGLE_API_KEY=${GOOGLE_API_KEY:-} + volumes: + - omnia-data:/app/apps/gui/data + +volumes: + omnia-data: