Files
calminer/Dockerfile
zwitschi e2f11a1459
Some checks failed
Build and Push Docker Image / build-and-push (push) Failing after 1m9s
Deploy to Server / deploy (push) Failing after 3s
refactor: Remove hardcoded production environment variables from Dockerfile
2025-10-23 19:41:13 +02:00

36 lines
1.1 KiB
Docker

# Multi-stage Dockerfile to keep final image small
FROM python:3.10-slim AS builder
# Install build-time packages and Python dependencies in one layer
WORKDIR /app
COPY requirements.txt /app/requirements.txt
RUN echo 'Acquire::http::Proxy "http://192.168.88.14:3142";' > /etc/apt/apt.conf.d/90proxy
RUN apt-get update \
&& apt-get install -y --no-install-recommends build-essential gcc libpq-dev \
&& python -m pip install --upgrade pip \
&& pip install --no-cache-dir --prefix=/install -r /app/requirements.txt \
&& apt-get purge -y --auto-remove build-essential gcc \
&& rm -rf /var/lib/apt/lists/*
FROM python:3.10-slim
WORKDIR /app
# Copy installed packages from builder
COPY --from=builder /install /usr/local
# Assume environment variables for DB config will be set at runtime
# ENV DATABASE_HOST=your_db_host
# ENV DATABASE_PORT=your_db_port
# ENV DATABASE_NAME=your_db_name
# ENV DATABASE_USER=your_db_user
# ENV DATABASE_PASSWORD=your_db_password
# Copy application code
COPY . /app
# Expose service port
EXPOSE 8000
# Run the FastAPI app with uvicorn
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]