Skip to content

Commit 6f219df

Browse files
authored
Create Dockerfile
1 parent c9cac58 commit 6f219df

1 file changed

Lines changed: 48 additions & 0 deletions

File tree

Dockerfile

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# Use Python 3.10 slim image as base
2+
FROM python:3.10-slim
3+
4+
# Set environment variables
5+
ENV PYTHONUNBUFFERED=1 \
6+
PYTHONDONTWRITEBYTECODE=1 \
7+
PIP_NO_CACHE_DIR=1 \
8+
PIP_DISABLE_PIP_VERSION_CHECK=1
9+
10+
# Install system dependencies including Redis
11+
RUN apt-get update && apt-get install -y \
12+
redis-server \
13+
libmagic1 \
14+
curl \
15+
&& rm -rf /var/lib/apt/lists/*
16+
17+
# Create a non-root user and group
18+
RUN addgroup --system omnipkg && adduser --system --ingroup omnipkg omnipkg
19+
20+
# Set working directory
21+
WORKDIR /home/omnipkg
22+
23+
# Copy requirements first (for better caching)
24+
COPY --chown=omnipkg:omnipkg requirements.txt* ./
25+
26+
# Install omnipkg from PyPI
27+
RUN pip install omnipkg
28+
29+
# Switch to non-root user
30+
USER omnipkg
31+
32+
# Create directories for omnipkg data
33+
RUN mkdir -p /home/omnipkg/.omnipkg
34+
35+
# Expose Redis port (in case external access needed)
36+
EXPOSE 6379
37+
38+
# Copy startup script
39+
COPY --chown=omnipkg:omnipkg docker-entrypoint.sh .
40+
RUN chmod +x docker-entrypoint.sh
41+
42+
# Health check
43+
HEALTHCHECK --interval=30s --timeout=10s --start-period=10s --retries=3 \
44+
CMD redis-cli ping || exit 1
45+
46+
# Default command
47+
ENTRYPOINT ["./docker-entrypoint.sh"]
48+
CMD ["omnipkg", "--help"]

0 commit comments

Comments
 (0)