forked from shotgun-sh/shotgun
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
75 lines (59 loc) · 2.61 KB
/
Dockerfile
File metadata and controls
75 lines (59 loc) · 2.61 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# Use Python 3.13 slim as base image
FROM python:3.13-slim
# Build arguments for telemetry configuration
# These are used during the build process to embed analytics keys
ARG SHOTGUN_SENTRY_DSN=""
ARG SHOTGUN_POSTHOG_API_KEY=""
ARG SHOTGUN_POSTHOG_PROJECT_ID=""
ARG SHOTGUN_LOGFIRE_ENABLED=""
ARG SHOTGUN_LOGFIRE_TOKEN=""
ARG SHOTGUN_BUILD_SKIP_VALIDATION=""
# OCI annotations for package metadata
LABEL org.opencontainers.image.title="Shotgun" \
org.opencontainers.image.description="AI-powered CLI tool for research, planning, and task management. Always use :latest for production - see README for details." \
org.opencontainers.image.source="https://github.com/shotgun-sh/shotgun" \
org.opencontainers.image.licenses="MIT" \
org.opencontainers.image.vendor="Shotgun" \
org.opencontainers.image.url="https://shotgun.sh"
# Set environment variables
ENV PYTHONUNBUFFERED=1 \
PYTHONDONTWRITEBYTECODE=1 \
UV_SYSTEM_PYTHON=1
# Install uv for dependency management
RUN pip install --no-cache-dir uv
# Create non-root user
RUN useradd -m -u 1000 shotgun
# Set working directory for build
WORKDIR /app
# Copy project files
COPY --chown=shotgun:shotgun pyproject.toml uv.lock hatch_build.py ./
COPY --chown=shotgun:shotgun src/ ./src/
COPY --chown=shotgun:shotgun README.md LICENSE ./
COPY --chown=shotgun:shotgun docs/README_DOCKER.md ./docs/
# Install dependencies
# Pass build args as environment variables for the build hook
RUN SHOTGUN_SENTRY_DSN="${SHOTGUN_SENTRY_DSN}" \
SHOTGUN_POSTHOG_API_KEY="${SHOTGUN_POSTHOG_API_KEY}" \
SHOTGUN_POSTHOG_PROJECT_ID="${SHOTGUN_POSTHOG_PROJECT_ID}" \
SHOTGUN_LOGFIRE_ENABLED="${SHOTGUN_LOGFIRE_ENABLED}" \
SHOTGUN_LOGFIRE_TOKEN="${SHOTGUN_LOGFIRE_TOKEN}" \
SHOTGUN_BUILD_SKIP_VALIDATION="${SHOTGUN_BUILD_SKIP_VALIDATION}" \
uv sync --frozen --no-dev
# Create directories for workspace and config
RUN mkdir -p /workspace /home/shotgun/.shotgun-sh && \
chown -R shotgun:shotgun /workspace /home/shotgun/.shotgun-sh
# Switch to non-root user
USER shotgun
# Set working directory to workspace
WORKDIR /workspace
# Expose default web server port
EXPOSE 8000
# Health check for web server
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
CMD python -c "import urllib.request; urllib.request.urlopen('http://localhost:8000').read()" || exit 1
# Add .venv/bin to PATH so shotgun command is available
ENV PATH="/app/.venv/bin:$PATH"
# Entry point - run shotgun in web mode with force-reindex for Docker
ENTRYPOINT ["shotgun", "--web", "--host", "0.0.0.0", "--force-reindex"]
# Default port (can be overridden)
CMD ["--port", "8000"]