Skip to content

Commit 58bf9fc

Browse files
Fixed docker permissions on results folder.
1 parent a404448 commit 58bf9fc

File tree

2 files changed

+34
-31
lines changed

2 files changed

+34
-31
lines changed

Dockerfile

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,6 @@ RUN apt-get update && apt-get install -y \
6363
wget \
6464
&& rm -rf /var/lib/apt/lists/*
6565

66-
# Create non-root user
67-
RUN groupadd -g 1001 -r appgroup && \
68-
useradd -u 1001 -r -g appgroup appuser
69-
7066
# Set working directory
7167
WORKDIR /app
7268

@@ -79,11 +75,19 @@ COPY --from=builder /code /app
7975

8076
# Create directories with proper permissions
8177
RUN mkdir -p /app/results /app/datasets && \
82-
chown -R appuser:appgroup /app && \
78+
chmod -R 777 /app/results /app/datasets && \
8379
chmod -R 755 /app
8480

85-
# Switch to non-root user
86-
USER appuser
81+
# Create entrypoint script to handle user permissions
82+
RUN echo '#!/bin/bash\n\
83+
# Handle user permissions for volume mounts\n\
84+
if [ "$1" = "run.py" ]; then\n\
85+
# Ensure results directory is writable\n\
86+
mkdir -p /app/results\n\
87+
chmod 777 /app/results\n\
88+
fi\n\
89+
exec python "$@"' > /app/entrypoint.sh && \
90+
chmod +x /app/entrypoint.sh
8791

8892
# Health check
8993
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
@@ -93,7 +97,7 @@ HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
9397
EXPOSE 6379 6380
9498

9599
# Set entrypoint
96-
ENTRYPOINT ["python"]
100+
ENTRYPOINT ["/app/entrypoint.sh"]
97101

98102
# Default command (show help)
99103
CMD ["run.py", "--help"]

README.md

Lines changed: 22 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -84,14 +84,14 @@ docker pull filipe958/vector-db-benchmark:latest
8484
# Run with help
8585
docker run --rm filipe958/vector-db-benchmark:latest run.py --help
8686

87-
# Basic Redis benchmark with local Redis
88-
docker run --rm --network=host filipe958/vector-db-benchmark:latest \
89-
run.py --host localhost --engines redis --dataset random-100 --experiment redis-default-simple
90-
91-
# With results output (mount current directory)
87+
# Basic Redis benchmark with local Redis (recommended)
9288
docker run --rm -v $(pwd)/results:/app/results --network=host \
9389
filipe958/vector-db-benchmark:latest \
94-
run.py --host localhost --engines redis --dataset random-100 --experiment redis-default-simple
90+
run.py --host localhost --engines redis-default-simple --dataset random-100
91+
92+
# Without results output
93+
docker run --rm --network=host filipe958/vector-db-benchmark:latest \
94+
run.py --host localhost --engines redis-default-simple --dataset random-100
9595
```
9696

9797
### Using with Redis
@@ -103,11 +103,12 @@ For testing with Redis, start a Redis container first:
103103
docker run -d --name redis-test -p 6379:6379 redis:8.2-rc1-bookworm
104104

105105
# Run benchmark against Redis
106-
docker run --rm --network=host filipe958/vector-db-benchmark:latest \
107-
run.py --host localhost --engines redis --dataset random-100 --experiment redis-default-simple
106+
docker run --rm -v $(pwd)/results:/app/results --network=host \
107+
filipe958/vector-db-benchmark:latest \
108+
run.py --host localhost --engines redis-default-simple --dataset random-100
108109

109110
# Or use the convenience script
110-
./docker-run.sh -H localhost -e redis -d random-100 -x redis-default-simple
111+
./docker-run.sh -H localhost -e redis-default-simple -d random-100
111112

112113
# Clean up Redis container when done
113114
docker stop redis-test && docker rm redis-test
@@ -149,20 +150,18 @@ poetry install
149150
Run the benchmark:
150151

151152
```bash
152-
Usage: run.py [OPTIONS]
153-
154-
Example: python3 -m run --engines *-m-16-* --datasets glove-*
155-
156-
Options:
157-
--engines TEXT [default: *]
158-
--datasets TEXT [default: *]
159-
--host TEXT [default: localhost]
160-
--skip-upload / --no-skip-upload
161-
[default: no-skip-upload]
162-
--install-completion Install completion for the current shell.
163-
--show-completion Show completion for the current shell, to
164-
copy it or customize the installation.
165-
--help Show this message and exit.
153+
# Basic usage examples
154+
python run.py --engines redis-default-simple --dataset random-100
155+
python run.py --engines redis-default-simple --dataset glove-25-angular
156+
python run.py --engines "*-m-16-*" --dataset "glove-*"
157+
158+
# Docker usage (recommended)
159+
docker run --rm -v $(pwd)/results:/app/results --network=host \
160+
filipe958/vector-db-benchmark:latest \
161+
run.py --host localhost --engines redis-default-simple --dataset random-100
162+
163+
# Get help
164+
python run.py --help
166165
```
167166

168167
Command allows you to specify wildcards for engines and datasets.

0 commit comments

Comments
 (0)