feat: add ImageFind application and release pipelines
This commit is contained in:
+50
@@ -0,0 +1,50 @@
|
||||
ARG NODE_IMAGE=node:22-bookworm-slim
|
||||
ARG PYTHON_IMAGE=python:3.12-slim-bookworm
|
||||
|
||||
FROM ${NODE_IMAGE} AS frontend-build
|
||||
WORKDIR /src/frontend
|
||||
COPY frontend/package.json frontend/package-lock.json ./
|
||||
RUN npm ci
|
||||
COPY frontend/ ./
|
||||
RUN npm run build
|
||||
|
||||
FROM ${PYTHON_IMAGE} AS wheel-build
|
||||
WORKDIR /src
|
||||
COPY pyproject.toml README.md ./
|
||||
COPY backend/ ./backend/
|
||||
RUN python -m pip install --no-cache-dir 'hatchling>=1.25,<2' \
|
||||
&& python -m hatchling build -t wheel -d /wheels
|
||||
|
||||
FROM ${PYTHON_IMAGE}
|
||||
ARG PGVECTOR_VERSION=0.8.6
|
||||
ARG PGVECTOR_PACKAGE_VERSION_URL=0.8.6-1.pgdg12%2B1
|
||||
ARG PGVECTOR_SHA256=b27ff894d1e2d23ebd7528fcb986923391977cbd5c5379ed74527875246854ca
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y --no-install-recommends ca-certificates curl ffmpeg postgresql-15 postgresql-client-15 rclone tini \
|
||||
&& curl --fail --location --retry 4 --retry-all-errors \
|
||||
"https://apt.postgresql.org/pub/repos/apt/pool/main/p/pgvector/postgresql-15-pgvector_${PGVECTOR_PACKAGE_VERSION_URL}_amd64.deb" \
|
||||
--output /tmp/pgvector.deb \
|
||||
&& printf '%s %s\n' "$PGVECTOR_SHA256" /tmp/pgvector.deb | sha256sum --check --status \
|
||||
&& dpkg -i /tmp/pgvector.deb \
|
||||
&& rm -f /tmp/pgvector.deb \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
COPY requirements/runtime-core.txt /opt/imagefind/runtime-core.txt
|
||||
COPY --from=wheel-build /wheels/imagefind-*.whl /opt/imagefind/
|
||||
RUN python -m pip install --no-cache-dir -r /opt/imagefind/runtime-core.txt /opt/imagefind/imagefind-*.whl \
|
||||
&& useradd --system --home-dir /nonexistent --shell /usr/sbin/nologin imagefind
|
||||
COPY --from=frontend-build /src/frontend/dist/ /opt/imagefind/frontend/
|
||||
COPY scripts/docker-entrypoint.sh /usr/local/bin/imagefind-entrypoint
|
||||
RUN chmod 0755 /usr/local/bin/imagefind-entrypoint && mkdir -p /data
|
||||
ENV IMAGEFIND_DATA_DIR=/data/imagefind \
|
||||
IMAGEFIND_FRONTEND_DIR=/opt/imagefind/frontend \
|
||||
IMAGEFIND_HOST=0.0.0.0 \
|
||||
IMAGEFIND_PORT=8765 \
|
||||
IMAGEFIND_DIRECT_ACCESS=true \
|
||||
IMAGEFIND_POSTGRES_CONF=/data/postgres-client.conf \
|
||||
TZ=Asia/Shanghai
|
||||
VOLUME ["/data"]
|
||||
EXPOSE 8765
|
||||
HEALTHCHECK --interval=30s --timeout=5s --start-period=30s --retries=4 \
|
||||
CMD pg_isready -h 127.0.0.1 -p 5432 -d imagefind -q \
|
||||
&& curl -fsS http://127.0.0.1:8765/ >/dev/null || exit 1
|
||||
ENTRYPOINT ["/usr/bin/tini", "--", "/usr/local/bin/imagefind-entrypoint"]
|
||||
Reference in New Issue
Block a user