deployed 0.1

This commit is contained in:
2026-03-04 00:56:08 -04:00
parent bf7af2b426
commit 185fa42caa
14 changed files with 371 additions and 27 deletions

View File

@@ -1,27 +1,65 @@
FROM python:3.14-alpine
FROM python:3.12-slim
# Install TA-Lib C library and build dependencies
RUN apk add --no-cache --virtual .build-deps \
gcc \
g++ \
make \
musl-dev \
wget \
&& apk add --no-cache \
ta-lib \
&& rm -rf /var/cache/apk/*
ARG CONFIG=production
# Install TA-Lib C library early for better layer caching
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
gcc \
g++ \
make \
wget \
ca-certificates \
&& wget http://prdownloads.sourceforge.net/ta-lib/ta-lib-0.4.0-src.tar.gz \
&& tar -xzf ta-lib-0.4.0-src.tar.gz \
&& cd ta-lib/ \
&& ./configure --prefix=/usr \
&& make \
&& make install \
&& cd .. \
&& rm -rf ta-lib ta-lib-0.4.0-src.tar.gz \
&& apt-get purge -y --auto-remove gcc g++ make wget ca-certificates \
&& rm -rf /var/lib/apt/lists/*
# Install Python build dependencies early for better layer caching
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
gcc \
g++ \
cargo \
rustc
# Install compiled packages - separate layer so requirements.txt changes don't trigger recompilation
COPY backend/requirements-pre.txt /app/requirements-pre.txt
RUN --mount=type=cache,target=/root/.cache/pip \
--mount=type=cache,target=/root/.cargo \
pip install --no-cache-dir -r /app/requirements-pre.txt \
&& apt-get purge -y --auto-remove gcc g++ cargo rustc \
&& rm -rf /var/lib/apt/lists/* /root/.rustup /tmp/*
# Set working directory
WORKDIR /app
# Copy requirements first for better caching
# Copy and install remaining requirements
COPY backend/requirements.txt /app/requirements.txt
# Install Python dependencies
# Install Python dependencies and clean up
RUN pip install --no-cache-dir -r requirements.txt
# Clean up build dependencies
RUN apk del .build-deps
# Copy application code
COPY backend/src /app/src
COPY backend/config*.yaml /tmp/
RUN if [ -f /tmp/config-${CONFIG}.yaml ]; then \
cp /tmp/config-${CONFIG}.yaml /app/config.yaml; \
else \
cp /tmp/config.yaml /app/config.yaml; \
fi && rm -rf /tmp/config*.yaml
# Add src to PYTHONPATH for correct module resolution
ENV PYTHONPATH=/app/src
# Expose port
EXPOSE 8000
# Run the application
CMD ["python", "-m", "uvicorn", "src.main:app", "--host", "0.0.0.0", "--port", "8000"]