Switch to Alpine Linux and improve deployment reliability
- Switch from Debian (python:3.11-slim) to Alpine (python:3.11-alpine) for better ARM64 support - Replace apt-get with apk package manager for lighter, faster builds - Update package dependencies for Alpine (musl-dev, postgresql-dev, linux-headers) - Change user creation from useradd to adduser (Alpine syntax) - Add .gitkeep files to preserve empty alembic directories in git - Update all quickstart scripts to always rebuild containers with --build flag - Fixes ARM64 package installation errors on Apple Silicon Macs - Fixes missing alembic directory errors on fresh clones 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
17
Dockerfile
17
Dockerfile
@@ -1,14 +1,15 @@
|
|||||||
FROM python:3.11-slim
|
FROM python:3.11-alpine
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
# Install system dependencies
|
# Install system dependencies for Alpine
|
||||||
# Use --no-install-recommends and handle both amd64 and arm64 architectures
|
# Alpine uses apk instead of apt-get and is lighter/faster
|
||||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
RUN apk add --no-cache \
|
||||||
gcc \
|
gcc \
|
||||||
|
musl-dev \
|
||||||
|
postgresql-dev \
|
||||||
postgresql-client \
|
postgresql-client \
|
||||||
libpq-dev \
|
linux-headers
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
|
||||||
|
|
||||||
# Copy requirements and install Python dependencies
|
# Copy requirements and install Python dependencies
|
||||||
COPY requirements.txt .
|
COPY requirements.txt .
|
||||||
@@ -21,8 +22,8 @@ COPY alembic/ ./alembic/
|
|||||||
COPY alembic.ini .
|
COPY alembic.ini .
|
||||||
COPY static/ ./static/
|
COPY static/ ./static/
|
||||||
|
|
||||||
# Create non-root user
|
# Create non-root user (Alpine uses adduser instead of useradd)
|
||||||
RUN useradd -m -u 1000 appuser && chown -R appuser:appuser /app
|
RUN adduser -D -u 1000 appuser && chown -R appuser:appuser /app
|
||||||
USER appuser
|
USER appuser
|
||||||
|
|
||||||
# Expose port
|
# Expose port
|
||||||
|
|||||||
Reference in New Issue
Block a user