Issue Deploying Newer SP-7 Image on amd64 Architecture

Hi,

After numerous attempts, I was finally able to successfully run the newer SP-7 image on an amd64 system. The issue stemmed from a missing shebang line (#!/bin/bash) at the beginning of the entrypoint script (/opt/specify7/docker-entrypoint.sh) in the latest SP-7 image.

To resolve this, I built a custom image based on specifyconsortium/specify7-service:v7, ensuring the correct shebang was present at the top of the entrypoint script. This resolved the issue and allowed the container to start properly.

Here’s the relevant snippet from my Dockerfile:

FROM specifyconsortium/specify7-service:v7
# Ensure you are root for fixing entrypoint
USER root
# Fix entrypoint
RUN head -n 1 /opt/specify7/docker-entrypoint.sh | grep -q '^#!.*bash' || \
    sed -i '1i #!/bin/bash' /opt/specify7/docker-entrypoint.sh && \
    chmod +x /opt/specify7/docker-entrypoint.sh
USER specify

Would it be possible to include the #!/bin/bash line in future official builds of the SP-7 image for the amd64 architecture to avoid the need for custom rebuilding?

Also, while SP-7 now runs correctly on my server, I’ve noticed that the “About” window still doesn’t display the Specify 7 version information. Am I perhaps missing a configuration step?

Thanks for your support,
Héryk

FYI. Grant posted a request for the #!/bin/bash line fix on Github: Add missing shebang to docker_entrypoint · specify/specify7@4618ba9
Thanks

Good morning @Heryk

Yup, the missing shebang should be added back in 7.10.3, has been merged

The missing version should be in >= 7.10, was a bug in 7.9. But it looks like you have v7, so it should be pulling 7.10. Can you check the git SHA, no further configuration should be necessary for it to return. Your build date is 2 weeks ago, whereas 7.10.0 was last pushed 15 days according to dockerhub (although I don’t know how to see the first date the image was pushed, in theory it would just be pushed once upon initial release)

1 Like

Hi @markp,
Thanks! Great to hear that the missing shebang will be included again in version 7.10.3. :blush:

Quick question—when I click on the “git SHA” in the About window, it just takes me to the general link: https://github.com/specify/specify7/commit/

Is it supposed to point to a specific commit instead?

Cheers,
Héryk

Hi Heryk,

Oh yes! I didn’t even notice that was also odd, there should be the hash there, and it should take you to the exact commit.

The bug for the version doesn’t mention that the SHA should also be missing (it is present in the screenshots showing the missing version) EDIT: The SHA missing is also part of the bug as seen in the title of the PR that fixes it

If you run docker images that should also show you the tag of the images I believe.

Hi @markp,

As a temporary workaround for the shebang issue, I’ve rebuilt the image using the Consortium’s v7 tagged base image. However, I noticed that this tag doesn’t explicitly indicate which version of SP-7 it includes.

Here’s the base image I used:

REPOSITORY                                         TAG    IMAGE ID      CREATED         SIZE
docker.io/specifyconsortium/specify7-service       v7     7cbfd8cb7f02  2 weeks ago     322 MB

And here’s my rebuilt version:

REPOSITORY                                         TAG    IMAGE ID      CREATED          SIZE
localhost/cfservice/specify7-service-ssl           v7     4e486aae2b18  About an hour ago 328 MB

Cheers,
Héryk

Hi Heryk,

I should have foreseen that the tag would display as v7 with that command. Dockerhub lists that as also being built 15 days ago, so assuming you have rebuilt, I don’t have any remaining inferences on why you would not be on 7.10.1, and therefore not have the version bug fixed. I can try on my local dev copy to see if I can pull with v7 successfully.

docker compose pull
docker compose up --force-recreate --build -d

Source: How to update existing images with docker-compose? - Stack Overflow. Note it also lists a prune which is optional.

1 Like
1 Like

FYI @markp & @Grant
I replaced my v7 image with the v7.10.0 & v7.10.1 images (including the temporary shebang fix), but I’m still seeing the same issue—the version number and Git SHA are missing from the About window.

1 Like

PS. Is it possible that this issue only affects the images built for the amd64 architecture?

I can also reproduce on both 7.10.0 and 7.10.1 and v7 (even after most recent push by alec at around 10:30 PST) on amd64.

1 Like

I pushed a new image to specifyconsortium/specify7-service:v7 that should fix the git_sha and builder_version issue.

It seems there is an issue with the shebang in the docker-entrypoint.sh file between the arm64 and amd64 images. It seems using #!/usr/bin/env sh is a more universal shebang than #!/bin/bash. We’ll update that in production, but if the shebang is still an issue for your instance, try using this more universal shebang.

1 Like

It worked, @alec.white — thank you! :blush:

I used your updated specifyconsortium/specify7-service:v7 image and rebuilt my custom image, modifying the Dockerfile to include your suggested shebang (#!/usr/bin/env sh).

Here’s the relevant section of the Dockerfile:

FROM specifyconsortium/specify7-service:v7

# Ensure you are root for package installs and cert updates as well as when fixing entrypoint
USER root

# Fix entrypoint – this ensures the script uses a portable, shell-agnostic shebang.
# It adds '#!/usr/bin/env sh' if missing, and replaces any existing shebang.
RUN grep -q '^#!' /opt/specify7/docker-entrypoint.sh || \
    sed -i '1i #!/usr/bin/env sh' /opt/specify7/docker-entrypoint.sh && \
    sed -i '1s|^#!.*|#!/usr/bin/env sh|' /opt/specify7/docker-entrypoint.sh && \
    chmod +x /opt/specify7/docker-entrypoint.sh

# Switch back to the default user
USER specify

The Specify7 version now correctly shows as v7.10.2 in the About window — great progress!
However, I noticed that the Git SHA still links generically to https://github.com/specify/specify7/commit/ without referencing a specific commit.

This is strange
 I also noticed that the “Build Date” displayed in the About window indicates “2 weeks ago”. Shouldn’t it indicate yesterday?

Cheers!

@Heryk Maybe check your docker-compose.yml file. In the specify7 section of the file, if you are adding image: specifyconsortium/specify7-service:v7 instead of building locally, then you will need to comment out this line - "./specifyweb:/opt/specify7/specifyweb" to avoid overwriting. If you are using one of the docker-compose.yml file from the docker-compositions GitHub repo, then there shouldn’t be a problem. This issue would only happening if you are editing the default docker-compose.yml file the specify7 GitHub repo.

I just double checked by pulling the v7 image again, and it seemed to work. I’ll try to think of another possibility as to why it wouldn’t work for you.

Maybe try building locally if it’s still not working.

docker build \
  --no-cache \
  --build-arg BUILD_VERSION=v7.10.1 \
  --build-arg GIT_SHA=$(git rev-parse HEAD) \
  -t specifyconsortium/specify7-service:v7 \
  .

Another option would be add the args to the specify7 in the docker-compose.yml when building locally

  specify7:
    build:
      context: ./.
      target: run-development
      args:
        BUILD_VERSION: v7.10.1
        GIT_SHA: eebbae4b587deb0d80967b68f65beeec92f5c547

Sorry for this odd issue, hopefully we can figure it out.

1 Like

Hi @alec.white,

For security compliance, we’re required to use Podman instead of Docker, which is why I’ve been manually starting all containers for the past year rather than using Docker Compose.

The reason I’m building a new local image on top of the v7 base image is to ensure compatibility with my amd64 architecture. Specifically, I needed to add a proper shebang (#!/usr/bin/env sh) to the docker-entrypoint.sh file — without this change, the application fails to run in my environment. BTW, I’m also adding my root certificats to my new image.

Here are the two Podman commands I’m using to start the Specify service and worker:

Specify7 service:

podman run --detach --pod sp7_pod --name sp7_specify7 \
  -u root \
  -v static-files:/volumes/static-files:Z \
  -v ./specify_settings.py:/opt/specify7/settings/local_specify_settings.py:ro,Z \
  --env-file='./specify.env' \
  cfservice/specify7-service-ssl:v7-dev

Specify7 worker:

podman run --detach --pod sp7_pod --name sp7_specify7-worker \
  -v static-files:/volumes/static-files \
  -v ./specify_settings.py:/opt/specify7/settings/local_specify_settings.py:ro,Z \
  --env-file='./specify.env' \
  cfservice/specify7-service-ssl:v7-dev \
  ve/bin/celery -A specifyweb worker -l INFO --concurrency=1

As recommended in the latest Specify7 release, I’ve also added the following variable to my specify.env file:

SPECIFY_CONFIG_DIR = "/opt/specify7/config"

I did compare my container startup commands with the docker-compose.yml file from the docker-compositions/all-in-one repository (production branch), but I couldn’t find the “specifyweb” line you mentioned about commenting out:

- "./specifyweb:/opt/specify7/specifyweb"

Could you clarify where that line appears, or whether it might be from a different branch or configuration?

Thanks again!

Hey @Heryk

Your podman run commands look correct.

It’s odd that the sp7 version and build date seem to be working for you, but not the Git SHA. The git_sha and build_version are both build parameters for building the Specify7 image, which are then added to there own files for the front-end to fetch when needed. So, theoretically they should either both work, or neither should work.

Test the state of the relevant files with the following commands:

podman exec specify7-specify7-1 cat specifyweb/frontend/static/git_sha.txt;
podman exec specify7-specify7-1 cat specifyweb/frontend/static/build_date.txt;
podman exec specify7-specify7-1 cat specifyweb/frontend/static/build_version.txt;

Another test would be to try writing to the git_sha.txt file directly and seeing if it’s getting found by the front-end. Try running this command and then refreshing the webpage:

podman exec specify7-specify7-1 touch specifyweb/frontend/static/git_sha.txt;
podman exec specify7-specify7-1 echo "4618ba9a86858a249c45c9d781f2e54e79a147a8" > specifyweb/frontend/static/git_sha.txt;

When you create a build that is uses v7 as the base image, maybe try adding the build arguments to the command, that might fix the issue (depending on podmanfile/dockerfile).

podman build \
 --build-arg BUILD_VERSION=v7.10.2 \
 --build-arg GIT_SHA="$(git rev-parse HEAD)" \
 --no-cache \
 .

Since your basing your podman commands off of the docker-compositions repo all-in-one docker-compose.yml file, you should be good. The case I mentioned about possibly needed to comment out a line was just for the Specify7 repo docker-compose.yml file. The volumes on your run command look good.

If it’s not working, maybe also try running podman pull specifyconsortium/specify7-service:v7 one more time to ensure the latest version.

Let me know what value is in the specifyweb/frontend/static/git_sha.txt in your Specify 7 container (or if the file exists).

1 Like

He @alec.white
It’s now working but I haven’t changed a single thing on my side! Not sure I understand the reason! Caching?

I ran these commands in my container


cat specifyweb/frontend/static/git_sha.txt
4618ba9a86858a249c45c9d781f2e54e79a147a8
cat specifyweb/frontend/static/build_date.txt
Wed Apr 23 15:43:16 UTC 2025
cat specifyweb/frontend/static/build_version.txt
v7.10.2

And then I checked the “About” window aging and it was displaying the correct information now! The Git SHA and Build Date are displaying the correct information! :thinking:

Anyway, your new v.7.10.2 image works fine for me now!

Thanks again for your help!

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.