-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
44 lines (33 loc) · 1.15 KB
/
Copy pathDockerfile
File metadata and controls
44 lines (33 loc) · 1.15 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
# EchoNest - Collaborative Music Queue System
# Python 3 Docker image with security hardening
# Pin to specific version with digest for reproducibility
FROM python:3.11-slim-bookworm@sha256:549988ff0804593d8373682ef5c0f0ceee48328abaaa2e054241c23f5c324751
# Install system dependencies (including curl for health checks)
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
libpq-dev \
curl \
&& rm -rf /var/lib/apt/lists/*
# Set working directory
WORKDIR /app
# Copy requirements first for better caching
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Create non-root user for security
RUN groupadd --gid 1000 echonest && \
useradd --uid 1000 --gid 1000 --shell /bin/bash --create-home echonest
# Copy application code
COPY . .
# Create directories for logs and oauth, set ownership
RUN mkdir -p /app/play_logs /app/oauth_creds && \
chown -R echonest:echonest /app
# Switch to non-root user
USER echonest
# Expose the application port
EXPOSE 5000
# Default environment variables
ENV REDIS_HOST=redis
ENV REDIS_PORT=6379
ENV DEBUG=false
# Run the application
CMD ["python", "run.py"]