An AI-powered search engine with a generative UI
TypeScript generative-aigenerative-uinextjsollamareactsearxngshadcn-uitailwindcsstavilytypescriptupstashvercel-ai-sdk
feat: add docker prebuild and GitHub Actions workflow
Yoshiki Miurad950902f50a0
diff --git a/.github/workflows/docker-build.yml b/.github/workflows/docker-build.ymlnew file mode 100644index 00000000..00280264--- /dev/null+++ b/.github/workflows/docker-build.yml@@ -0,0 +1,50 @@+name: Docker Build and Push++on:+ push:+ branches: [main]+ pull_request:+ branches: [main]++jobs:+ build:+ runs-on: ubuntu-latest+ permissions:+ contents: read+ packages: write++ steps:+ - name: Checkout repository+ uses: actions/checkout@v4++ - name: Set up Docker Buildx+ uses: docker/setup-buildx-action@v3++ - name: Login to GitHub Container Registry+ if: github.event_name != 'pull_request'+ uses: docker/login-action@v3+ with:+ registry: ghcr.io+ username: ${{ github.actor }}+ password: ${{ secrets.GITHUB_TOKEN }}++ - name: Build and push Docker image+ uses: docker/build-push-action@v5+ with:+ context: .+ push: ${{ github.event_name != 'pull_request' }}+ tags: |+ ghcr.io/${{ github.repository }}:latest+ ghcr.io/${{ github.repository }}:${{ github.sha }}+ cache-from: type=gha+ cache-to: type=gha,mode=max++ - name: Build Redis image+ uses: docker/build-push-action@v5+ with:+ context: .+ file: Dockerfile.redis+ push: ${{ github.event_name != 'pull_request' }}+ tags: |+ ghcr.io/${{ github.repository }}-redis:latest+ ghcr.io/${{ github.repository }}-redis:${{ github.sha }}diff --git a/Dockerfile b/Dockerfileindex 0eedf1b1..16011f6c 100644--- a/Dockerfile+++ b/Dockerfile@@ -1,15 +1,31 @@-FROM oven/bun:1.1.3-alpine+# Base image+FROM oven/bun:1.1.3-alpine AS builder+# Install build toolsRUN apk add --no-cache nodejs npm gitWORKDIR /app+# Install dependencies (separated for better cache utilization)COPY package.json bun.lockb ./RUN bun install+# Copy source code and buildCOPY . .-RUN bun next telemetry disable+RUN bun run build++# Runtime stage+FROM oven/bun:1.1.3-alpine AS runner+WORKDIR /app++# Copy only necessary files from builder+COPY --from=builder /app/.next ./.next+COPY --from=builder /app/public ./public+COPY --from=builder /app/package.json ./package.json+COPY --from=builder /app/bun.lockb ./bun.lockb+COPY --from=builder /app/node_modules ./node_modules+# Start development serverCMD ["bun", "dev", "-H", "0.0.0.0"]diff --git a/docker-compose.yaml b/docker-compose.yamlindex a36c45a6..f48b4642 100644--- a/docker-compose.yaml+++ b/docker-compose.yaml@@ -1,12 +1,16 @@-# This is a Docker Compose file for setting up the morphic-stack environment.+# Docker Compose configuration for the morphic-stack development environmentname: morphic-stackservices:morphic:+ image: ghcr.io/${GITHUB_REPOSITORY:-your-username/morphic}:latestbuild:- context: . # The build context is the current directory+ context: .dockerfile: Dockerfile- command: bun dev # Use `bun dev -H 0.0.0.0` to listen on all interfaces+ cache_from:+ - morphic:builder+ - morphic:latest+ command: bun dev -H 0.0.0.0env_file: .env.local # Load environment variablesports:- '3000:3000' # Maps port 3000 on the host to port 3000 in the container.