From 0ef30967dd5c4ff4a4754693bbaf3603789eecac Mon Sep 17 00:00:00 2001 From: Aaron Bolton Date: Mon, 21 Oct 2024 20:10:08 +0100 Subject: [PATCH] Docker Additions Added Dockerfile and docker-compose.yml, also adjusted start command to listen for all IP's and on Port 3000 --- Dockerfile | 29 +++++++++++++++++++++++++++++ docker-compose.yml | 23 +++++++++++++++++++++++ package.json | 2 +- 3 files changed, 53 insertions(+), 1 deletion(-) create mode 100644 Dockerfile create mode 100644 docker-compose.yml diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..de88d11 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,29 @@ +# Use an official Node.js runtime as the base image +FROM node:20.15.1 + +# Set the working directory in the container +WORKDIR /app + +# Install pnpm +RUN npm install -g pnpm@9.4.0 + +# Copy package.json and pnpm-lock.yaml (if available) +COPY package.json pnpm-lock.yaml* ./ + +# Install dependencies +RUN pnpm install + +# Copy the rest of the application code +COPY . . + +# Build the application +RUN pnpm run build + +# Make sure bindings.sh is executable +RUN chmod +x bindings.sh + +# Expose the port the app runs on (adjust if you specified a different port) +EXPOSE 3000 + +# Start the application +CMD ["pnpm", "run", "start"] \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..70b4fef --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,23 @@ +services: + bolt-app: + build: + context: . + dockerfile: Dockerfile + ports: + - "3000:3000" + environment: + - NODE_ENV=production + # Add any other environment variables your app needs + # - OPENAI_API_KEY=${OPENAI_API_KEY} + # - ANTHROPIC_API_KEY=${ANTHROPIC_API_KEY} + # - GROQ_API_KEY=${GROQ_API_KEY} + volumes: + # This volume is for development purposes, allowing live code updates + # Comment out or remove for production + - .:/app + # This volume is to prevent node_modules from being overwritten by the above volume + - /app/node_modules + command: pnpm run start + +volumes: + node_modules: \ No newline at end of file diff --git a/package.json b/package.json index 737ca05..7215888 100644 --- a/package.json +++ b/package.json @@ -14,7 +14,7 @@ "test:watch": "vitest", "lint": "eslint --cache --cache-location ./node_modules/.cache/eslint .", "lint:fix": "npm run lint -- --fix", - "start": "bindings=$(./bindings.sh) && wrangler pages dev ./build/client $bindings", + "start": "bindings=$(./bindings.sh) && wrangler pages dev ./build/client $bindings --ip 0.0.0.0 --port 3000", "typecheck": "tsc", "typegen": "wrangler types", "preview": "pnpm run build && pnpm run start"