copilot / Dockerfile
Kaballas's picture
123
6f8f9a0
Raw
History Blame Contribute Delete
1.12 kB
# Read the doc: https://huggingface.co/docs/hub/spaces-sdks-docker
# you will also find guides on how best to write your Dockerfile
# Build stage
FROM golang:1.25.6-bookworm AS builder
WORKDIR /app
# Copy go mod files
COPY go.mod go.sum ./
# Download dependencies
RUN go mod download
# Copy source code
COPY . .
# Build the binary
RUN go build -o copilot-server .
# Runtime stage
FROM node:22-bookworm
# Install GitHub CLI (gh) for token-based auth used by copilot-sdk
RUN apt-get update && \
apt-get install -y --no-install-recommends gh && \
rm -rf /var/lib/apt/lists/*
# Install GitHub Copilot CLI
RUN npm install -g @github/copilot@prerelease
# Create app directory
WORKDIR /app
# Copy the built binary from builder stage
COPY --from=builder /app/copilot-server /usr/local/bin/copilot-server
# Copy entrypoint script
COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
# Set flag for Hugging Face Spaces
ENV HF_SPACE=true
# Expose port for Hugging Face Spaces
EXPOSE 7860
# Run through entrypoint script to ensure token is set
ENTRYPOINT ["/entrypoint.sh"]
CMD ["-port", "7860"]