docker instructions cleanup

This commit is contained in:
Kirill Markin 2024-12-30 15:58:04 +01:00
parent 7c32b7a565
commit cde732c57d
No known key found for this signature in database
GPG key ID: 03AB9530E15B9C1C
4 changed files with 67 additions and 33 deletions

View file

@ -1,27 +0,0 @@
# Docker Usage Instructions
## Building and Running
1. Build the container:
```bash
docker-compose build
```
2. Start a shell session:
```bash
docker-compose run --rm repo-to-text
```
Once in the shell, you can run repo-to-text:
```bash
# Process current directory
repo-to-text
# Process specific directory
repo-to-text /home/user/myproject
# Use with options
repo-to-text --output-dir /home/user/output
```
The container mounts your home directory at `/home/user`, allowing access to all your projects.

View file

@ -1,13 +1,33 @@
FROM python:3.11-slim FROM python:3.12-slim
RUN apt-get update && apt-get install -y \ # Set environment variables
ENV PYTHONUNBUFFERED=1 \
PYTHONDONTWRITEBYTECODE=1 \
PIP_NO_CACHE_DIR=1
# Create non-root user
RUN useradd -m -s /bin/bash user
# Install system dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
tree \ tree \
&& rm -rf /var/lib/apt/lists/* && rm -rf /var/lib/apt/lists/*
RUN useradd -m -s /bin/bash user
WORKDIR /app WORKDIR /app
# Copy all necessary files for package installation
COPY pyproject.toml README.md ./
# Copy the package source
COPY repo_to_text ./repo_to_text
# Install the package
RUN pip install --no-cache-dir -e .
# Copy remaining files
COPY . . COPY . .
RUN pip install -e . && pip install pyperclip
# Set default user
USER user
ENTRYPOINT ["repo-to-text"] ENTRYPOINT ["repo-to-text"]

View file

@ -98,6 +98,44 @@ You can customize the behavior of `repo-to-text` with the following options:
This will write the output directly to `myfile.txt` instead of creating a timestamped file. This will write the output directly to `myfile.txt` instead of creating a timestamped file.
## Docker Usage
### Building and Running
1. Build the container:
```bash
docker compose build
```
2. Start a shell session:
```bash
docker compose run --rm repo-to-text
```
Once in the shell, you can run `repo-to-text`:
- Process current directory:
```bash
repo-to-text
```
- Process specific directory:
```bash
repo-to-text /home/user/myproject
```
- Use with options:
```bash
repo-to-text --output-dir /home/user/output
```
The container mounts your home directory at `/home/user`, allowing access to all your projects.
## Settings ## Settings
`repo-to-text` also supports configuration via a `.repo-to-text-settings.yaml` file. By default, the tool works without this file, but you can use it to customize what gets included in the final text file. `repo-to-text` also supports configuration via a `.repo-to-text-settings.yaml` file. By default, the tool works without this file, but you can use it to customize what gets included in the final text file.

View file

@ -1,10 +1,13 @@
services: services:
repo-to-text: repo-to-text:
build: . build:
context: .
dockerfile: Dockerfile
volumes: volumes:
- ${HOME:-/home/user}:/home/user - ${HOME:-/home/user}:/home/user
working_dir: /home/user working_dir: /home/user
environment: environment:
- HOME=/home/user - HOME=/home/user
user: "${UID:-1000}:${GID:-1000}" user: "${UID:-1000}:${GID:-1000}"
init: true
entrypoint: ["/bin/bash"] entrypoint: ["/bin/bash"]