summaryrefslogtreecommitdiff
path: root/server
diff options
context:
space:
mode:
authorShyam Sunder <sgsunder1@gmail.com>2020-06-04 16:38:26 -0400
committerShyam Sunder <sgsunder1@gmail.com>2020-06-04 16:38:26 -0400
commitea675d20cb949eb53a3d93e723ea57d924cbbb2d (patch)
treea9f5867f2e8e29a4fd1d1d2dc7fc970a66265d76 /server
parent6a95a66f12a5407cfd8ffa7e373f756236bf0bce (diff)
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
Diffstat (limited to 'server')
-rw-r--r--server/Dockerfile5
-rwxr-xr-xserver/hooks/test1
-rw-r--r--server/requirements.txt1
-rw-r--r--server/szurubooru/tests/func/test_image_hash.py4
-rw-r--r--server/szurubooru/tests/func/test_posts.py2
5 files changed, 8 insertions, 5 deletions
diff --git a/server/Dockerfile b/server/Dockerfile
index 3d1c7f8..b0a6d3c 100644
--- a/server/Dockerfile
+++ b/server/Dockerfile
@@ -1,4 +1,4 @@
-FROM alpine:latest
+FROM alpine:3.12
WORKDIR /opt/app
RUN \
@@ -7,6 +7,7 @@ RUN \
dumb-init \
ffmpeg \
py3-waitress \
+ py3-pip \
# from requirements.txt:
py3-yaml \
py3-psycopg2 \
@@ -22,7 +23,7 @@ RUN \
alembic \
"coloredlogs==5.0" \
youtube-dl \
- && exit 0
+ && apk --no-cache del py3-pip
ARG PUID=1000
ARG PGID=1000
diff --git a/server/hooks/test b/server/hooks/test
index 9cbb16b..056ca2c 100755
--- a/server/hooks/test
+++ b/server/hooks/test
@@ -11,6 +11,7 @@ FROM ${BASE_IMAGE}
WORKDIR /opt/app
USER root
RUN apk --no-cache add \
+ py3-pip \
py3-pytest \
py3-pytest-cov \
postgresql \
diff --git a/server/requirements.txt b/server/requirements.txt
index 810452e..d80ec06 100644
--- a/server/requirements.txt
+++ b/server/requirements.txt
@@ -9,3 +9,4 @@ pillow>=4.3.0
pynacl>=1.2.1
pytz>=2018.3
pyRFC3339>=1.0
+youtube-dl
diff --git a/server/szurubooru/tests/func/test_image_hash.py b/server/szurubooru/tests/func/test_image_hash.py
index 1025291..13bfae8 100644
--- a/server/szurubooru/tests/func/test_image_hash.py
+++ b/server/szurubooru/tests/func/test_image_hash.py
@@ -15,7 +15,7 @@ def test_signature_functions(read_asset, config_injector):
assert array_equal(sig2, sig2_repacked)
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)
assert abs(dist2[0]) < 1e-8
@@ -23,4 +23,4 @@ def test_signature_functions(read_asset, config_injector):
words1 = image_hash.generate_words(sig1)
words2 = image_hash.generate_words(sig2)
words_match = sum(word1 == word2 for word1, word2 in zip(words1, words2))
- assert words_match == 17
+ assert words_match == 18
diff --git a/server/szurubooru/tests/func/test_posts.py b/server/szurubooru/tests/func/test_posts.py
index 097136c..49f93be 100644
--- a/server/szurubooru/tests/func/test_posts.py
+++ b/server/szurubooru/tests/func/test_posts.py
@@ -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'))
assert len(result1) == 1
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
result2 = posts.search_by_image(read_asset('png.png'))