-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
63 lines (48 loc) · 1.55 KB
/
Dockerfile
File metadata and controls
63 lines (48 loc) · 1.55 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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# Production Dockerfile for Dual-Platform Video Uploader
# NoblePort Systems
FROM python:3.11-slim
# Set environment variables
ENV PYTHONUNBUFFERED=1 \
PYTHONDONTWRITEBYTECODE=1 \
PIP_NO_CACHE_DIR=1 \
PIP_DISABLE_PIP_VERSION_CHECK=1
# Create app user
RUN useradd -m -u 1000 appuser && \
mkdir -p /app /app/uploads && \
chown -R appuser:appuser /app
# Set working directory
WORKDIR /app
# Install system dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
wget \
curl \
ca-certificates \
&& rm -rf /var/lib/apt/lists/*
# Install IPFS
RUN wget -q https://dist.ipfs.io/kubo/v0.17.0/kubo_v0.17.0_linux-amd64.tar.gz && \
tar -xzf kubo_v0.17.0_linux-amd64.tar.gz && \
cd kubo && \
bash install.sh && \
cd .. && \
rm -rf kubo kubo_v0.17.0_linux-amd64.tar.gz
# Copy requirements first for better caching
COPY --chown=appuser:appuser requirements.txt .
# Install Python dependencies
RUN pip install --no-cache-dir -r requirements.txt && \
pip install --no-cache-dir gunicorn gevent
# Copy application files
COPY --chown=appuser:appuser . .
# Switch to app user
USER appuser
# Initialize IPFS (run as appuser)
RUN ipfs init || true
# Expose ports
EXPOSE 5000 5001 8080
# Health check
HEALTHCHECK --interval=30s --timeout=10s --start-period=40s --retries=3 \
CMD curl -f http://localhost:5000/health || exit 1
# Start script
COPY --chown=appuser:appuser deployment/docker-entrypoint.sh /app/
RUN chmod +x /app/docker-entrypoint.sh
ENTRYPOINT ["/app/docker-entrypoint.sh"]
CMD ["gunicorn"]