Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 48 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Poetry (except pyproject.toml and poetry.lock)
.poetry
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# Virtual environments
venv/
env/
ENV/
.venv

# IDE
.idea/
.vscode/
*.swp
*.swo

# Testing
.pytest/
.coverage
htmlcov/
.tox/
.mypy_cache/

# Documentation (except README.md)
*.md
!README.md # Keep README for documentation

# Build artifacts
dist/
build/
*.whl

# Slack export (if accidentally included)
*.zip
!docker-compose.yml # docker-compose stays

# Misc
.git/
.gitignore
.gitattributes
*.log
.env
.env.local
.DS_Store
Thumbs.db
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -69,4 +69,6 @@ target/
.vscode

# Environments
venv/
venv/

slack-export.zip
44 changes: 44 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# syntax=docker/dockerfile:1.4

# Build stage
FROM python:3.12-slim as builder

WORKDIR /app

# Install dependencies via pip (simpler for Docker)
COPY pyproject.toml poetry.lock ./
RUN pip install --no-cache-dir click werkzeug flask markdown2 emoji frozen-flask

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems prone to breaking over time. Is there no better way to install the dependencies properly?


# Runtime stage
FROM python:3.12-slim as runtime

# Install curl for healthcheck (optional)
RUN apt-get update && apt-get install -y \
curl \
&& rm -rf /var/lib/apt/lists/* \
&& apt-get purge -y --auto-remove

WORKDIR /app

# Copy dependencies from builder to ensure they're available in the runtime image
COPY --from=builder /usr/local/lib/python3.12/site-packages/ /usr/local/lib/python3.12/site-packages/
COPY --from=builder /usr/local/bin/ /usr/local/bin/

# Copy application code
COPY . .

# Create user with UID/GID matching host for file permissions
RUN groupadd -g 1000 app && useradd -u 1000 -g app -m app

# Switch to non-root user
USER app

# Expose default port
EXPOSE 5000

# Health check (optional)
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
CMD curl -f http://localhost:5000/ || exit 1

# Default command - can be overridden
CMD ["python", "app.py", "--help"]
58 changes: 58 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,64 @@ Options:
```


## Docker

You can run `slack-export-viewer` in a container using Docker and Docker Compose.

### Prerequisites

- Docker and Docker Compose installed
- Your Slack export archive (`.zip` file or directory)

### Quick Start

1. Build and run the container:

```bash
docker-compose up --build
```

2. Open your browser to [http://localhost:5000](http://localhost:5000)

### Configuration

Before running, customize the `docker-compose.yml` file:

- **Archive path**: Update the `source` in the volumes section to point to your Slack export archive
```yaml
volumes:
- type: bind
source: ./your-export.zip # Change this path
target: /app/slack-export.zip
read_only: true
```

- **Environment variables**: Modify the `environment` section to set options:
```yaml
environment:
- SEV_ARCHIVE=/app/slack-export.zip
- SEV_PORT=5000
- SEV_IP=0.0.0.0
- SEV_NO_BROWSER=true
- SEV_CHANNELS=general,random
- SEV_SHOW_DMS=false
```

See the [Usage](#usage) section for all available command-line options.

### Running in Background

```bash
docker-compose up -d
```

### Stopping the Container

```bash
docker-compose down
```


## Usage

### 1) Grab your Slack team's export
Expand Down
37 changes: 37 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
services:
slack-export-viewer:
build:
dockerfile: Dockerfile
target: runtime
image: slack-export-viewer:latest
container_name: slack-export-viewer
ports:
- "5000:5000"
volumes:
# Mount your Slack export archive directory/zip
- type: bind
source: ./slack-export.zip # CHANGE THIS to your archive path
target: /app/slack-export.zip
read_only: true
# Optional: persist cache or output directory
- slack-data:/app/.cache/slackviewer
environment:
- SEV_ARCHIVE=/app/slack-export.zip
- SEV_PORT=5000
- SEV_IP=0.0.0.0
- SEV_NO_BROWSER=true
# Optional configuration:
# - SEV_CHANNELS=general,random
# - SEV_HTML_ONLY=false
# - SEV_DEBUG=true
# - SEV_SHOW_DMS=false
# - SEV_NO_SIDEBAR=false
command: >
python app.py
--archive /app/slack-export.zip
--port 5000
--ip 0.0.0.0
--no-browser

volumes:
slack-data: