mirror of
https://github.com/velocitatem/cvfs.git
synced 2026-05-31 08:43:37 +00:00
Initial commit
This commit is contained in:
38
docker/ml.Dockerfile
Normal file
38
docker/ml.Dockerfile
Normal file
@@ -0,0 +1,38 @@
|
||||
FROM python:3.12-slim
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# System deps - layer rarely changes
|
||||
RUN apt-get update && apt-get install -y \
|
||||
gcc \
|
||||
g++ \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Install external dependencies only - layer cached until pyproject.toml changes.
|
||||
# Stub files satisfy setuptools' package discovery without real source,
|
||||
# so external deps are downloaded once and reused across source-only rebuilds.
|
||||
COPY pyproject.toml ./
|
||||
RUN touch README.md \
|
||||
&& mkdir -p alveslib && touch alveslib/__init__.py \
|
||||
&& pip install --no-cache-dir . \
|
||||
&& rm -rf alveslib README.md
|
||||
|
||||
# Copy local library and reinstall it without re-downloading external deps
|
||||
COPY alveslib/ ./alveslib/
|
||||
RUN pip install --no-cache-dir --no-deps .
|
||||
|
||||
# Copy application source last - most frequently changed
|
||||
COPY ml/ ./
|
||||
COPY src/ ./src/
|
||||
|
||||
RUN mkdir -p /app/models/weights
|
||||
|
||||
HEALTHCHECK --interval=30s --timeout=30s --start-period=60s --retries=3 \
|
||||
CMD python -c "import requests; requests.get('http://localhost:8000/health').raise_for_status()" || exit 1
|
||||
|
||||
EXPOSE 8000
|
||||
|
||||
RUN useradd --create-home --shell /bin/bash app
|
||||
RUN chown -R app:app /app
|
||||
USER app
|
||||
CMD ["uvicorn", "inference:app", "--host", "0.0.0.0", "--port", "8000"]
|
||||
34
docker/worker.Dockerfile
Normal file
34
docker/worker.Dockerfile
Normal file
@@ -0,0 +1,34 @@
|
||||
FROM python:3.12-slim
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# System deps - layer rarely changes
|
||||
RUN apt-get update && apt-get install -y \
|
||||
gcc \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Install external dependencies only - layer cached until pyproject.toml changes.
|
||||
# Stub files satisfy setuptools' package discovery without real source,
|
||||
# so external deps are downloaded once and reused across source-only rebuilds.
|
||||
COPY pyproject.toml ./
|
||||
RUN touch README.md \
|
||||
&& mkdir -p alveslib && touch alveslib/__init__.py \
|
||||
&& pip install --no-cache-dir . \
|
||||
&& rm -rf alveslib README.md
|
||||
|
||||
# Copy local library and reinstall it without re-downloading external deps
|
||||
COPY alveslib/ ./alveslib/
|
||||
RUN pip install --no-cache-dir --no-deps .
|
||||
|
||||
# Copy application source last - most frequently changed
|
||||
RUN mkdir -p ./worker/
|
||||
COPY apps/worker/ ./worker/
|
||||
COPY src/ ./src/
|
||||
|
||||
HEALTHCHECK --interval=30s --timeout=10s --start-period=30s --retries=3 \
|
||||
CMD python -c "import redis; r=redis.from_url('redis://redis:6379'); r.ping()" || exit 1
|
||||
|
||||
RUN useradd --create-home --shell /bin/bash app
|
||||
RUN chown -R app:app /app
|
||||
USER app
|
||||
CMD ["celery", "-A", "worker.worker:app", "worker", "--loglevel=info"]
|
||||
Reference in New Issue
Block a user