From 9dd40fb26b96d06cc3617361e2fa77804294cf9c Mon Sep 17 00:00:00 2001 From: melton-jason Date: Mon, 6 Oct 2025 23:13:28 -0500 Subject: [PATCH 1/5] chore: update dependencies Fixes #34, #26 Might fix #9 --- Dockerfile | 13 +++++++------ docker-compose.yml | 19 +++++++++++++++++++ requirements.txt | 10 ++++++---- server.py | 2 +- 4 files changed, 33 insertions(+), 11 deletions(-) create mode 100644 docker-compose.yml diff --git a/Dockerfile b/Dockerfile index 92ff2e6..1aeeb25 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,12 +1,12 @@ -FROM ubuntu:18.04 +FROM ubuntu:24.04 LABEL maintainer="Specify Collections Consortium " RUN apt-get update && apt-get -y install --no-install-recommends \ ghostscript \ imagemagick \ - python3.6 \ - python3-venv \ + python3.12 \ + python3.12-venv \ && apt-get clean && rm -rf /var/lib/apt/lists/* RUN groupadd -g 999 specify && \ @@ -14,12 +14,14 @@ RUN groupadd -g 999 specify && \ RUN mkdir -p /home/specify && chown specify.specify /home/specify +# COPY policy.xml /etc/ImageMagick-6/policy.xml + USER specify WORKDIR /home/specify COPY --chown=specify:specify requirements.txt . -RUN python3.6 -m venv ve && ve/bin/pip install --no-cache-dir -r requirements.txt +RUN python3.12 -m venv ve && ve/bin/pip install --no-cache-dir -r requirements.txt COPY --chown=specify:specify *.py views ./ @@ -34,5 +36,4 @@ RUN echo \ "\nDEBUG = os.getenv('DEBUG_MODE', 'false').lower() == 'true'" \ >> settings.py -EXPOSE 8080 -CMD ve/bin/python server.py +CMD ["ve/bin/python", "server.py"] diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..002e9af --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,19 @@ +services: + asset-server: + restart: unless-stopped + build: + context: ./. + init: true + volumes: + - "attachments:/home/specify/attachments" + - './settings.py:/home/specify/settings.py' + environment: + - SERVER_NAME=localhost + - SERVER_PORT=8080 + - ATTACHMENT_KEY=test_attachment_key + - DEBUG_MODE=true + ports: + - "8080:8080" + +volumes: + attachments: \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index 5e0c9a9..7157541 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,6 @@ -ExifRead==2.3.1 -Paste==3.4.4 -sh==1.14.0 -Bottle>=0.12.23,<0.13 +ExifRead==3.5.1 +Paste==3.10.1 +sh==2.0 +Bottle>=0.12.23,<=0.13 +boto3>=1.26.0,<2.0 +boto3-stubs>=1.26.0,<2.0 diff --git a/server.py b/server.py index b906f66..e112024 100644 --- a/server.py +++ b/server.py @@ -112,7 +112,7 @@ def wrapper(*args, **kwargs): except TokenException as e: response.content_type = 'text/plain; charset=utf-8' response.status = 403 - return e + return response return func(*args, **kwargs) return wrapper From f323028dbade9880867227eb01758f12edf89826 Mon Sep 17 00:00:00 2001 From: melton-jason Date: Mon, 6 Oct 2025 23:16:57 -0500 Subject: [PATCH 2/5] chore: remove unused policy copy in Dockerfile --- Dockerfile | 2 -- docker-compose.yml | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 1aeeb25..5c66b34 100644 --- a/Dockerfile +++ b/Dockerfile @@ -14,8 +14,6 @@ RUN groupadd -g 999 specify && \ RUN mkdir -p /home/specify && chown specify.specify /home/specify -# COPY policy.xml /etc/ImageMagick-6/policy.xml - USER specify WORKDIR /home/specify diff --git a/docker-compose.yml b/docker-compose.yml index 002e9af..773643d 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -16,4 +16,4 @@ services: - "8080:8080" volumes: - attachments: \ No newline at end of file + attachments: From 8f96c4db3a76a0decad160ae23f031625f748a5a Mon Sep 17 00:00:00 2001 From: melton-jason Date: Mon, 6 Oct 2025 23:38:03 -0500 Subject: [PATCH 3/5] chore: update sh python package --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 7157541..426da71 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,6 @@ ExifRead==3.5.1 Paste==3.10.1 -sh==2.0 +sh==2.2.1 Bottle>=0.12.23,<=0.13 boto3>=1.26.0,<2.0 boto3-stubs>=1.26.0,<2.0 From 1af1b19f8d25a372346adea4dacf01892723cef3 Mon Sep 17 00:00:00 2001 From: melton-jason Date: Mon, 6 Oct 2025 23:39:10 -0500 Subject: [PATCH 4/5] chore: update sh to 2.2.2 --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 426da71..0c2083e 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,6 @@ ExifRead==3.5.1 Paste==3.10.1 -sh==2.2.1 +sh==2.2.2 Bottle>=0.12.23,<=0.13 boto3>=1.26.0,<2.0 boto3-stubs>=1.26.0,<2.0 From ed9e0eab10e39c8ad1d2b1f379db16e8c5b41e35 Mon Sep 17 00:00:00 2001 From: melton-jason Date: Tue, 11 Nov 2025 11:38:53 -0600 Subject: [PATCH 5/5] docs: Add comments to aid in configuration and setup --- docker-compose.yml | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 773643d..913f65e 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -6,13 +6,22 @@ services: init: true volumes: - "attachments:/home/specify/attachments" - - './settings.py:/home/specify/settings.py' + # If you need to use the settings.py file, uncomment the following line. + # On container start-up, this bind mount will overwrite the changes made + # to the settings file during the Build process (e.g., parsing and + # "applying" the environment variables) + # - './settings.py:/home/specify/settings.py' environment: - - SERVER_NAME=localhost + - SERVER_NAME=host.docker.internal - SERVER_PORT=8080 - ATTACHMENT_KEY=test_attachment_key - DEBUG_MODE=true ports: + # Instead of exposing the host machine's port, you can add this container + # to an existing Docker network (e.g., one that the Specify 7 instance is + # on) + # See: + # https://docs.docker.com/compose/how-tos/networking/#use-an-existing-network - "8080:8080" volumes: