server/docker: fix missing installation requirements
Furthermore, an update to Pillow has improved the floating-point precision of the image hash algorithm, requiring minor updates to the respective unit tests. See https://github.com/python-pillow/Pillow/pull/4320
This commit is contained in:
parent
6a95a66f12
commit
ea675d20cb
5 changed files with 8 additions and 5 deletions
|
@ -1,4 +1,4 @@
|
||||||
FROM alpine:latest
|
FROM alpine:3.12
|
||||||
WORKDIR /opt/app
|
WORKDIR /opt/app
|
||||||
|
|
||||||
RUN \
|
RUN \
|
||||||
|
@ -7,6 +7,7 @@ RUN \
|
||||||
dumb-init \
|
dumb-init \
|
||||||
ffmpeg \
|
ffmpeg \
|
||||||
py3-waitress \
|
py3-waitress \
|
||||||
|
py3-pip \
|
||||||
# from requirements.txt:
|
# from requirements.txt:
|
||||||
py3-yaml \
|
py3-yaml \
|
||||||
py3-psycopg2 \
|
py3-psycopg2 \
|
||||||
|
@ -22,7 +23,7 @@ RUN \
|
||||||
alembic \
|
alembic \
|
||||||
"coloredlogs==5.0" \
|
"coloredlogs==5.0" \
|
||||||
youtube-dl \
|
youtube-dl \
|
||||||
&& exit 0
|
&& apk --no-cache del py3-pip
|
||||||
|
|
||||||
ARG PUID=1000
|
ARG PUID=1000
|
||||||
ARG PGID=1000
|
ARG PGID=1000
|
||||||
|
|
|
@ -11,6 +11,7 @@ FROM ${BASE_IMAGE}
|
||||||
WORKDIR /opt/app
|
WORKDIR /opt/app
|
||||||
USER root
|
USER root
|
||||||
RUN apk --no-cache add \
|
RUN apk --no-cache add \
|
||||||
|
py3-pip \
|
||||||
py3-pytest \
|
py3-pytest \
|
||||||
py3-pytest-cov \
|
py3-pytest-cov \
|
||||||
postgresql \
|
postgresql \
|
||||||
|
|
|
@ -9,3 +9,4 @@ pillow>=4.3.0
|
||||||
pynacl>=1.2.1
|
pynacl>=1.2.1
|
||||||
pytz>=2018.3
|
pytz>=2018.3
|
||||||
pyRFC3339>=1.0
|
pyRFC3339>=1.0
|
||||||
|
youtube-dl
|
||||||
|
|
|
@ -15,7 +15,7 @@ def test_signature_functions(read_asset, config_injector):
|
||||||
assert array_equal(sig2, sig2_repacked)
|
assert array_equal(sig2, sig2_repacked)
|
||||||
|
|
||||||
dist1 = image_hash.normalized_distance([sig1], sig2)
|
dist1 = image_hash.normalized_distance([sig1], sig2)
|
||||||
assert abs(dist1[0] - 0.20599895341812172) < 1e-8
|
assert abs(dist1[0] - 0.19713075553164386) < 1e-8
|
||||||
|
|
||||||
dist2 = image_hash.normalized_distance([sig2], sig2)
|
dist2 = image_hash.normalized_distance([sig2], sig2)
|
||||||
assert abs(dist2[0]) < 1e-8
|
assert abs(dist2[0]) < 1e-8
|
||||||
|
@ -23,4 +23,4 @@ def test_signature_functions(read_asset, config_injector):
|
||||||
words1 = image_hash.generate_words(sig1)
|
words1 = image_hash.generate_words(sig1)
|
||||||
words2 = image_hash.generate_words(sig2)
|
words2 = image_hash.generate_words(sig2)
|
||||||
words_match = sum(word1 == word2 for word1, word2 in zip(words1, words2))
|
words_match = sum(word1 == word2 for word1, word2 in zip(words1, words2))
|
||||||
assert words_match == 17
|
assert words_match == 18
|
||||||
|
|
|
@ -991,7 +991,7 @@ def test_search_by_image(post_factory, config_injector, read_asset):
|
||||||
result1 = posts.search_by_image(read_asset('jpeg-similar.jpg'))
|
result1 = posts.search_by_image(read_asset('jpeg-similar.jpg'))
|
||||||
assert len(result1) == 1
|
assert len(result1) == 1
|
||||||
result1_distance, result1_post = result1[0]
|
result1_distance, result1_post = result1[0]
|
||||||
assert abs(result1_distance - 0.20599895341812172) < 1e-8
|
assert abs(result1_distance - 0.19713075553164386) < 1e-8
|
||||||
assert result1_post.post_id == post.post_id
|
assert result1_post.post_id == post.post_id
|
||||||
|
|
||||||
result2 = posts.search_by_image(read_asset('png.png'))
|
result2 = posts.search_by_image(read_asset('png.png'))
|
||||||
|
|
Loading…
Reference in a new issue