jira-webhook-llm/Dockerfile
Ireneusz Bachanowicz 935a8a49ae
Some checks are pending
CI/CD Pipeline / test (push) Waiting to run
Almost stable tests
2025-07-17 02:21:56 +02:00

52 lines
1.4 KiB
Docker

# syntax=docker/dockerfile:1.4
# --- Stage 1: Build Dependencies ---
# Using a specific, stable Python version on Alpine for a small final image.
FROM python:3.10-alpine3.18 AS builder
WORKDIR /app
# Install build dependencies for Python packages.
RUN apk add --no-cache --virtual .build-deps \
build-base \
gcc \
musl-dev \
python3-dev \
linux-headers
# Copy only the requirements file first to leverage Docker's build cache.
COPY requirements.txt .
# Install Python dependencies.
RUN pip install --no-cache-dir -r requirements.txt
# Remove build dependencies to keep the final image lean.
RUN apk del .build-deps
# --- Stage 2: Runtime Environment ---
# Start fresh with a lean Alpine Python image.
FROM python:3.10-alpine3.18
WORKDIR /app
# Copy installed Python packages from the builder stage.
COPY --from=builder /usr/local/lib/python3.10/site-packages /usr/local/lib/python3.10/site-packages
COPY --from=builder /usr/local/bin /usr/local/bin
# Set environment variables for Python.
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1
# Copy the configuration directory first.
# If only code changes, this layer remains cached.
COPY config ./config
# Copy your application source code.
COPY jira_webhook_llm.py .
COPY config.py .
# Expose the port your application listens on.
EXPOSE 8000
# Define the command to run your application.
CMD ["uvicorn", "jira-webhook-llm:app", "--host", "0.0.0.0", "--port", "8000"]