Skip to content

Commit 491ab14

Browse files
committed
Dockerfile: Improve portability
The base image tomcat:10.1.40-jdk21 is actually based on Ubuntu noble but we are still using Ubuntu jammy builder and perforce apt source. Fix by making Ubuntu version explict everywhere. helix-p4d is only available on 386/amd64, filter it out on other architectures. maintainer/source/description labels are only supposed to be set on official builds, which is already done by docker/metadata-action GitHub action, so remove them here. Signed-off-by: Jiaxun Yang <[email protected]>
1 parent 096cb4b commit 491ab14

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

Dockerfile

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Copyright (c) 2018, 2025 Oracle and/or its affiliates. All rights reserved.
22
# Portions Copyright (c) 2020, Chris Fraire <[email protected]>.
33

4-
FROM ubuntu:jammy AS build
4+
FROM ubuntu:noble AS build
55

66
# hadolint ignore=DL3008
77
RUN apt-get update && apt-get install --no-install-recommends -y openjdk-21-jdk python3 python3-venv && \
@@ -41,7 +41,7 @@ RUN cp `ls -t distribution/target/*.tar.gz | head -1` /opengrok.tar.gz
4141
# Store the version in a file so that the tools can report it.
4242
RUN /mvn/mvnw help:evaluate -Dexpression=project.version -q -DforceStdout > /mvn/VERSION
4343

44-
FROM tomcat:10.1.40-jdk21
44+
FROM tomcat:10.1.40-jdk21-temurin-noble
4545
LABEL maintainer="https://github.com/oracle/opengrok"
4646
LABEL org.opencontainers.image.source="https://github.com/oracle/opengrok"
4747
LABEL org.opencontainers.image.description="OpenGrok code search"
@@ -54,7 +54,7 @@ SHELL ["/bin/bash", "-o", "pipefail", "-c"]
5454
# hadolint ignore=DL3059
5555
RUN curl -sS https://package.perforce.com/perforce.pubkey | gpg --dearmor > /etc/apt/trusted.gpg.d/perforce.gpg
5656
# hadolint ignore=DL3059
57-
RUN echo 'deb https://package.perforce.com/apt/ubuntu jammy release' > /etc/apt/sources.list.d/perforce.list
57+
RUN echo 'deb https://package.perforce.com/apt/ubuntu noble release' > /etc/apt/sources.list.d/perforce.list
5858

5959
# install dependencies and Python tools
6060
# hadolint ignore=DL3008,DL3009
@@ -63,10 +63,13 @@ RUN apt-get update && \
6363
unzip python3 python3-pip \
6464
python3-venv python3-setuptools openssh-client libyaml-dev
6565

66+
ARG TARGETARCH
6667
# hadolint ignore=DL3008,DL3059
67-
RUN architecture=$(uname -m) && if [[ "$architecture" == "aarch64" ]]; then \
68-
echo "aarch64: do not install helix-p4d."; else \
69-
apt-get install --no-install-recommends -y helix-p4d || echo "Failed to install Perforce"; fi
68+
RUN if [ "$TARGETARCH" = "amd64" ] || [ "$TARGETARCH" = "386" ]; then \
69+
apt-get install --no-install-recommends -y helix-p4d || echo "Failed to install Perforce"; \
70+
else \
71+
echo "Architecture $TARGETARCH: skipping helix-p4d installation"; \
72+
fi
7073

7174
# compile and install universal-ctags
7275
# hadolint ignore=DL3003,DL3008

0 commit comments

Comments
 (0)