Skip to content

Commit

Permalink
Merge pull request #1109 from leonsgithub/main
Browse files Browse the repository at this point in the history
Add docker
  • Loading branch information
eugeis authored Nov 5, 2024
2 parents f5abaac + 4453afb commit f2d9e0e
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.git
.gitignore
.env
README.md
docker-compose.yml
Dockerfile
41 changes: 41 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Use official golang image as builder
FROM golang:1.22.5-alpine AS builder

# Set working directory
WORKDIR /app

# Copy go mod and sum files
COPY go.mod go.sum ./

# Download dependencies
RUN go mod download

# Copy source code
COPY . .

# Build the application
RUN CGO_ENABLED=0 GOOS=linux go build -o fabric

# Use scratch as final base image
FROM alpine:latest

# Copy the binary from builder
COPY --from=builder /app/fabric /fabric

# Copy patterns directory
COPY patterns /patterns

# Ensure clean config directory and copy ENV file
RUN rm -rf /root/.config/fabric && \
mkdir -p /root/.config/fabric
COPY ENV /root/.config/fabric/.env

# Add debug commands
RUN ls -la /root/.config/fabric/

# Expose port 8080
EXPOSE 8080

# Run the binary with debug output
ENTRYPOINT ["/fabric"]
CMD ["--serve"]
9 changes: 9 additions & 0 deletions ENV
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
DEFAULT_VENDOR=OpenRouter
DEFAULT_MODEL=openai/gpt-3.5-turbo-0125
DEFAULT_MODEL_CONTEXT_LENGTH=128K
PATTERNS_LOADER_GIT_REPO_URL=https://github.com/danielmiessler/fabric.git
PATTERNS_LOADER_GIT_REPO_PATTERNS_FOLDER=patterns
OPENROUTER_API_KEY=sk-or-v1-
OPENROUTER_API_BASE_URL=https://openrouter.ai/api/v1
YOUTUBE_API_KEY=AIzaS
JINA_AI_API_KEY=jina_57
11 changes: 11 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
version: '3.8'

services:
fabric-api:
build: .
ports:
- "8080:8080"
volumes:
- ./ENV:/root/.config/fabric/.env:ro
environment:
- GIN_MODE=release

0 comments on commit f2d9e0e

Please sign in to comment.