Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 28 additions & 3 deletions .github/workflows/docker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,39 @@ jobs:
type=sha,format=short
type=raw,value=${{ github.ref_name }},enable=${{ startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/main' || github.ref == 'refs/heads/stable' }}

- name: Build and push Docker image
- name: Extract metadata for Express Docker image
id: meta-express
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=raw,value=latest-express,enable=${{ github.ref == 'refs/heads/main' }}
type=raw,value=stable-express,enable=${{ github.ref == 'refs/heads/stable' }}
type=ref,event=tag,suffix=-express
type=raw,value=${{ github.ref_name }}-express,enable=${{ startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/main' || github.ref == 'refs/heads/stable' }}

- name: Build and push Docker image (Default)
uses: docker/build-push-action@v6
with:
context: .
platforms: linux/amd64,linux/arm64
target: bolt-diy-production
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}


- name: Build and push Docker image (Express)
uses: docker/build-push-action@v6
with:
context: .
platforms: linux/amd64,linux/arm64
target: bolt-diy-express
push: true
tags: ${{ steps.meta-express.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

- name: Check manifest
run: docker buildx imagetools inspect ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.meta.outputs.version }}
run: docker buildx imagetools inspect ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.meta.outputs.version }}

- name: Check Express manifest
run: docker buildx imagetools inspect ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.meta-express.outputs.version }}
43 changes: 41 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ COPY . .
EXPOSE 5173

# Production image
FROM base AS bolt-ai-production
FROM base AS bolt-diy-production

# Define environment variables with default values or let them be overridden
ARG GROQ_API_KEY
Expand Down Expand Up @@ -60,7 +60,7 @@ RUN pnpm run build
CMD [ "pnpm", "run", "dockerstart"]

# Development image
FROM base AS bolt-ai-development
FROM base AS bolt-diy-development

# Define the same environment variables for development
ARG GROQ_API_KEY
Expand Down Expand Up @@ -93,3 +93,42 @@ ENV GROQ_API_KEY=${GROQ_API_KEY} \

RUN mkdir -p ${WORKDIR}/run
CMD pnpm run dev --host


# Express image
FROM base AS bolt-diy-express

# Define the same environment variables for development
ARG GROQ_API_KEY
ARG HuggingFace
ARG OPENAI_API_KEY
ARG ANTHROPIC_API_KEY
ARG OPEN_ROUTER_API_KEY
ARG GOOGLE_GENERATIVE_AI_API_KEY
ARG OLLAMA_API_BASE_URL
ARG XAI_API_KEY
ARG TOGETHER_API_KEY
ARG TOGETHER_API_BASE_URL
ARG VITE_LOG_LEVEL=debug
ARG DEFAULT_NUM_CTX

ENV GROQ_API_KEY=${GROQ_API_KEY} \
HuggingFace_API_KEY=${HuggingFace_API_KEY} \
OPENAI_API_KEY=${OPENAI_API_KEY} \
ANTHROPIC_API_KEY=${ANTHROPIC_API_KEY} \
OPEN_ROUTER_API_KEY=${OPEN_ROUTER_API_KEY} \
GOOGLE_GENERATIVE_AI_API_KEY=${GOOGLE_GENERATIVE_AI_API_KEY} \
OLLAMA_API_BASE_URL=${OLLAMA_API_BASE_URL} \
XAI_API_KEY=${XAI_API_KEY} \
TOGETHER_API_KEY=${TOGETHER_API_KEY} \
TOGETHER_API_BASE_URL=${TOGETHER_API_BASE_URL} \
AWS_BEDROCK_CONFIG=${AWS_BEDROCK_CONFIG} \
VITE_LOG_LEVEL=${VITE_LOG_LEVEL} \
DEFAULT_NUM_CTX=${DEFAULT_NUM_CTX}\
RUNNING_IN_DOCKER=true

RUN mkdir -p ${WORKDIR}/run

RUN pnpm run build
RUN pnpm runtime:express_build
CMD pnpm runtime:express
8 changes: 5 additions & 3 deletions app/entry.server.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import type { AppLoadContext } from '@remix-run/cloudflare';
import { RemixServer } from '@remix-run/react';
import { isbot } from 'isbot';
import { renderToReadableStream } from 'react-dom/server';

//@ts-ignore ts throws error because of the missing type definition
import { renderToReadableStream } from 'react-dom/server.browser';
import { renderHeadToString } from 'remix-island';
import { Head } from './root';
import { themeStore } from '~/lib/stores/theme';
Expand Down Expand Up @@ -40,7 +42,7 @@ export default async function handleRequest(
function read() {
reader
.read()
.then(({ done, value }) => {
.then(({ done, value }: any) => {
if (done) {
controller.enqueue(new Uint8Array(new TextEncoder().encode('</div></body></html>')));
controller.close();
Expand All @@ -51,7 +53,7 @@ export default async function handleRequest(
controller.enqueue(value);
read();
})
.catch((error) => {
.catch((error: any) => {
controller.error(error);
readable.cancel();
});
Expand Down
8 changes: 7 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
"sideEffects": false,
"type": "module",
"version": "0.0.7",
"workspaces": [
"runtimes/bolt-diy-express"
],
"scripts": {
"deploy": "npm run build && wrangler pages deploy",
"build": "remix vite:build",
Expand All @@ -25,7 +28,10 @@
"typegen": "wrangler types",
"preview": "pnpm run build && pnpm run start",
"prepare": "husky",
"clean": "node scripts/clean.js"
"clean": "node scripts/clean.js",
"setup-runtime:express": "pnpm install --filter bolt-diy-express install",
"runtime:express_build": "pnpm run setup-runtime:express && pnpm --filter bolt-diy-express build",
"runtime:express": "pnpm --filter bolt-diy-express start"
},
"engines": {
"node": ">=18.18.0"
Expand Down
Loading