Skip to content

Commit 4453afb

Browse files
committed
Add docker
1 parent 96c8117 commit 4453afb

File tree

4 files changed

+67
-0
lines changed

4 files changed

+67
-0
lines changed

.dockerignore

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
.git
2+
.gitignore
3+
.env
4+
README.md
5+
docker-compose.yml
6+
Dockerfile

Dockerfile

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Use official golang image as builder
2+
FROM golang:1.22.5-alpine AS builder
3+
4+
# Set working directory
5+
WORKDIR /app
6+
7+
# Copy go mod and sum files
8+
COPY go.mod go.sum ./
9+
10+
# Download dependencies
11+
RUN go mod download
12+
13+
# Copy source code
14+
COPY . .
15+
16+
# Build the application
17+
RUN CGO_ENABLED=0 GOOS=linux go build -o fabric
18+
19+
# Use scratch as final base image
20+
FROM alpine:latest
21+
22+
# Copy the binary from builder
23+
COPY --from=builder /app/fabric /fabric
24+
25+
# Copy patterns directory
26+
COPY patterns /patterns
27+
28+
# Ensure clean config directory and copy ENV file
29+
RUN rm -rf /root/.config/fabric && \
30+
mkdir -p /root/.config/fabric
31+
COPY ENV /root/.config/fabric/.env
32+
33+
# Add debug commands
34+
RUN ls -la /root/.config/fabric/
35+
36+
# Expose port 8080
37+
EXPOSE 8080
38+
39+
# Run the binary with debug output
40+
ENTRYPOINT ["/fabric"]
41+
CMD ["--serve"]

ENV

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
DEFAULT_VENDOR=OpenRouter
2+
DEFAULT_MODEL=openai/gpt-3.5-turbo-0125
3+
DEFAULT_MODEL_CONTEXT_LENGTH=128K
4+
PATTERNS_LOADER_GIT_REPO_URL=https://github.com/danielmiessler/fabric.git
5+
PATTERNS_LOADER_GIT_REPO_PATTERNS_FOLDER=patterns
6+
OPENROUTER_API_KEY=sk-or-v1-
7+
OPENROUTER_API_BASE_URL=https://openrouter.ai/api/v1
8+
YOUTUBE_API_KEY=AIzaS
9+
JINA_AI_API_KEY=jina_57

docker-compose.yml

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
version: '3.8'
2+
3+
services:
4+
fabric-api:
5+
build: .
6+
ports:
7+
- "8080:8080"
8+
volumes:
9+
- ./ENV:/root/.config/fabric/.env:ro
10+
environment:
11+
- GIN_MODE=release

0 commit comments

Comments
 (0)