-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile
More file actions
47 lines (36 loc) · 1.43 KB
/
Copy pathDockerfile
File metadata and controls
47 lines (36 loc) · 1.43 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
# Start from a Python base image
FROM python:3.10-slim
# Set environment variables
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
# Install system dependencies
# Note: redis-server removed - omnipkg uses SQLite fallback when Redis unavailable
RUN apt-get update && apt-get install -y \
libmagic1 \
curl \
&& rm -rf /var/lib/apt/lists/*
# Create a non-root user and group
RUN addgroup --system omnipkg && \
adduser --system --ingroup omnipkg --no-create-home omnipkg
# Set the working directory and create it with correct ownership
WORKDIR /home/omnipkg
RUN chown omnipkg:omnipkg /home/omnipkg
# Copy project files with ownership
COPY --chown=omnipkg:omnipkg pyproject.toml poetry.lock* ./
COPY --chown=omnipkg:omnipkg src/ ./src/
COPY --chown=omnipkg:omnipkg README.md ./
COPY --chown=omnipkg:omnipkg pyproject.toml poetry.lock* build_hooks.py ./
# Install Python dependencies AS ROOT (needed for pip)
RUN pip install --no-cache-dir .
# Copy the entrypoint script
COPY --chown=omnipkg:omnipkg docker-entrypoint.sh ./
RUN chmod +x docker-entrypoint.sh
# Create data directory and set proper ownership — MUST be done as root before switching user
RUN mkdir -p /home/omnipkg/.omnipkg && \
chown -R omnipkg:omnipkg /home/omnipkg
# NOW switch to non-root user
USER omnipkg
# Expose port (removed Redis port 6379 since we're not including Redis in container)
EXPOSE 8000
# Entry point
ENTRYPOINT ["/home/omnipkg/docker-entrypoint.sh"]