diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 000000000..f667105b4 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,6 @@ +.git +.gitignore +.env +README.md +docker-compose.yml +Dockerfile \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 000000000..a7277ce8c --- /dev/null +++ b/Dockerfile @@ -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"] \ No newline at end of file diff --git a/ENV b/ENV new file mode 100644 index 000000000..3cfedc332 --- /dev/null +++ b/ENV @@ -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 diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 000000000..73d31b63e --- /dev/null +++ b/docker-compose.yml @@ -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 \ No newline at end of file