mirror of
https://github.com/stackblitz/bolt.new
synced 2025-02-06 04:48:04 +00:00
commit
47a7932061
39
.github/workflows/github-build-push.yml
vendored
Normal file
39
.github/workflows/github-build-push.yml
vendored
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
name: Build and Push Container
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
# paths:
|
||||||
|
# - 'Dockerfile'
|
||||||
|
workflow_dispatch:
|
||||||
|
jobs:
|
||||||
|
build-and-push:
|
||||||
|
runs-on: [ubuntu-latest]
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Set up QEMU
|
||||||
|
uses: docker/setup-qemu-action@v1
|
||||||
|
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v1
|
||||||
|
|
||||||
|
- name: Login to GitHub Container Registry
|
||||||
|
uses: docker/login-action@v1
|
||||||
|
with:
|
||||||
|
registry: ghcr.io
|
||||||
|
username: ${{ github.actor }}
|
||||||
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: Build and Push Containers
|
||||||
|
uses: docker/build-push-action@v2
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
file: Dockerfile
|
||||||
|
platforms: linux/amd64,linux/arm64
|
||||||
|
push: true
|
||||||
|
tags: |
|
||||||
|
ghcr.io/${{ github.repository }}:latest
|
||||||
|
ghcr.io/${{ github.repository }}:${{ github.sha }}
|
29
Dockerfile
Normal file
29
Dockerfile
Normal file
@ -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"]
|
24
docker-compose.yml
Normal file
24
docker-compose.yml
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
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}
|
||||||
|
# - OPEN_ROUTER_API_KEY=${OPEN_ROUTER_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:
|
@ -14,7 +14,7 @@
|
|||||||
"test:watch": "vitest",
|
"test:watch": "vitest",
|
||||||
"lint": "eslint --cache --cache-location ./node_modules/.cache/eslint .",
|
"lint": "eslint --cache --cache-location ./node_modules/.cache/eslint .",
|
||||||
"lint:fix": "npm run lint -- --fix",
|
"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",
|
"typecheck": "tsc",
|
||||||
"typegen": "wrangler types",
|
"typegen": "wrangler types",
|
||||||
"preview": "pnpm run build && pnpm run start"
|
"preview": "pnpm run build && pnpm run start"
|
||||||
|
Loading…
Reference in New Issue
Block a user