diff --git a/Dockerfile b/Dockerfile index 92ff2e6..5c66b34 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 && \ @@ -19,7 +19,7 @@ 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 +34,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..913f65e --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,28 @@ +services: + asset-server: + restart: unless-stopped + build: + context: ./. + init: true + volumes: + - "attachments:/home/specify/attachments" + # 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=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: + attachments: diff --git a/requirements.txt b/requirements.txt index 5e0c9a9..0c2083e 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.2.2 +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