This is an automated email from the ASF dual-hosted git repository.

tn pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tooling-trusted-release.git


The following commit(s) were added to refs/heads/main by this push:
     new 0b75cce  update Dockerfile for ubuntu as well, use bash as default 
shell
0b75cce is described below

commit 0b75cce569d521ba15f04a4bcb80a6c1c35be558
Author: Thomas Neidhart <[email protected]>
AuthorDate: Wed Mar 19 21:19:19 2025 +0100

    update Dockerfile for ubuntu as well, use bash as default shell
---
 Dockerfile.alpine |   1 +
 Dockerfile.ubuntu | 112 +++++++++++++++++++++++++++++++++++++++---------------
 start-atr.sh      |   2 +-
 3 files changed, 83 insertions(+), 32 deletions(-)

diff --git a/Dockerfile.alpine b/Dockerfile.alpine
index c3af852..008df56 100644
--- a/Dockerfile.alpine
+++ b/Dockerfile.alpine
@@ -46,6 +46,7 @@ ENV JAVA_TOOL_OPTIONS="-XX:MaxMetaspaceSize=32m -Xmx128m 
-XX:+UseSerialGC -XX:Ma
 # openjdk8 is required for Apache RAT
 RUN apk update && \
     apk add --no-cache \
+      bash \
       curl \
       file \
       git \
diff --git a/Dockerfile.ubuntu b/Dockerfile.ubuntu
index bde3c02..799538a 100644
--- a/Dockerfile.ubuntu
+++ b/Dockerfile.ubuntu
@@ -1,4 +1,42 @@
 # We can't use 24.10 because deadsnakes does not yet support it
+FROM ubuntu:24.04 AS builder
+
+ENV PIP_DEFAULT_TIMEOUT=100 \
+    PIP_DISABLE_PIP_VERSION_CHECK=1 \
+    PIP_NO_CACHE_DIR=1 \
+    PYTHONUNBUFFERED=1 \
+    POETRY_VERSION=2.1.1
+
+RUN apt-get update && \
+    apt-get install -y \
+      make \
+      git \
+      software-properties-common
+
+RUN add-apt-repository ppa:deadsnakes/ppa && \
+    apt update && \
+    apt install -y python3.13 python3.13-venv python3.13-dev
+
+RUN rm -rf /usr/local && python3.13 -m venv /usr/local
+
+RUN pip3 install poetry==${POETRY_VERSION}
+
+# use the same workdir as in the final image
+# as the created venv will use that path
+WORKDIR /opt/atr
+
+COPY . .
+
+# install development dependencies to generate version
+RUN make sync-dev PYTHON="$(find /usr/bin -name python3.13 | head -n 1)"
+
+# generate a _version.py module from git information
+RUN make generate-version
+
+# only install runtime dependencies
+RUN make sync PYTHON="$(find /usr/bin -name python3.13 | head -n 1)"
+
+# final image
 FROM ubuntu:24.04
 
 ARG BIND=127.0.0.1:4443
@@ -6,51 +44,63 @@ ENV BIND=${BIND}
 ARG SCRIPTS=scripts/poetry
 ENV SCRIPTS=${SCRIPTS}
 
-RUN apt-get update && apt-get install -y \
-    curl \
-    git \
-    gpg \
-    make \
-    openjdk-8-jdk \
-    software-properties-common
+ENV PYTHONDONTWRITEBYTECODE=1 \
+    PYTHONUNBUFFERED=1
 
 # Set JAVA_TOOL_OPTIONS to limit memory usage
 ENV JAVA_TOOL_OPTIONS="-XX:MaxMetaspaceSize=32m -Xmx128m -XX:+UseSerialGC 
-XX:MaxRAM=256m -XX:CompressedClassSpaceSize=16m"
 
-RUN add-apt-repository ppa:deadsnakes/ppa \
-    && apt update \
-    && apt install -y python3.13 python3.13-venv python3.13-dev
+RUN apt-get update && \
+    apt-get install -y --no-install-recommends \
+      bash \
+      curl \
+      git \
+      gpg \
+      make \
+      openjdk-8-jdk \
+      software-properties-common && \
+    rm -rf /var/lib/apt/lists/*
+
+RUN add-apt-repository ppa:deadsnakes/ppa && \
+    apt update && \
+    apt install -y python3.13 python3.13-venv python3.13-dev && \
+    rm -rf /var/lib/apt/lists/*
 
-ENV PYTHONUNBUFFERED=1
 RUN rm -rf /usr/local && python3.13 -m venv /usr/local
-RUN pip3 install setuptools wheel pip-tools poetry uv
+
 WORKDIR /opt/atr
-COPY . /opt/atr
+
+# copy app and wheels from builder
+COPY --from=builder /opt/atr/.venv ./.venv
+COPY --from=builder /opt/atr/atr ./atr
+COPY --from=builder /opt/atr/migrations ./migrations
+COPY --from=builder /opt/atr/scripts ./scripts
+COPY --from=builder /opt/atr/Makefile .
+COPY --from=builder /opt/atr/alembic.ini .
+COPY --from=builder /opt/atr/start-atr.sh .
+
+RUN chmod +x ./start-atr.sh
+
+# install additional tools
+ENV RAT_VERSION=0.16.1
+
+RUN mkdir -p /opt/tools
 RUN mkdir -p /tmp/apache-rat
 WORKDIR /tmp/apache-rat
-RUN curl -L 
https://dlcdn.apache.org/creadur/apache-rat-0.16.1/apache-rat-0.16.1-bin.tar.gz 
-o apache-rat.tar.gz
+RUN curl -L 
https://dlcdn.apache.org/creadur/apache-rat-${RAT_VERSION}/apache-rat-${RAT_VERSION}-bin.tar.gz
 -o apache-rat.tar.gz
 RUN tar -xzf apache-rat.tar.gz
-RUN find apache-rat-0.16.1 -type f -name "*.jar" -exec cp {} . \;
+RUN find apache-rat-${RAT_VERSION} -type f -name "*.jar" -exec cp {} . \;
 # Rename to match expected filename if needed
-RUN [ -f apache-rat-0.16.1.jar ] || mv $(find . -maxdepth 1 -type f -name 
"apache-rat*.jar" | head -1) apache-rat-0.16.1.jar
+RUN [ -f apache-rat-${RAT_VERSION}.jar ] || mv $(find . -maxdepth 1 -type f 
-name "apache-rat*.jar" | head -1) apache-rat-${RAT_VERSION}.jar
+RUN mv apache-rat-${RAT_VERSION}.jar /opt/tools
 RUN java -version
-WORKDIR /opt/atr
+
 # TODO: We should pin the syft version
 # RUN GOPATH=/usr/local go install github.com/anchore/syft/cmd/syft@latest
 RUN curl -sSfL https://raw.githubusercontent.com/anchore/syft/main/install.sh 
| sh -s -- -b /usr/local/bin
-COPY . /opt/atr
-RUN rm -rf .venv-*
-RUN make sync PYTHON="$(find /usr/bin -name python3.13 | head -n 1)"
+
 EXPOSE 4443
 
-RUN printf '#!/bin/sh\n\
-cd /opt/atr\n\
-test -d /opt/atr/state || mkdir -p /opt/atr/state\n\
-make certs\n\
-cp /tmp/apache-rat/apache-rat-0.16.1.jar /opt/atr/state/\n\
-echo "Copied Apache RAT JAR to state directory:"\n\
-ls -la /opt/atr/state/apache-rat-0.16.1.jar\n\
-exec make serve BIND=${BIND}\n\
-' > /usr/local/bin/start-atr.sh
-RUN chmod +x /usr/local/bin/start-atr.sh
-CMD ["/usr/local/bin/start-atr.sh"]
+WORKDIR /opt/atr
+
+CMD ["./start-atr.sh"]
diff --git a/start-atr.sh b/start-atr.sh
index d9f346e..c60dd88 100644
--- a/start-atr.sh
+++ b/start-atr.sh
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
 set -e
 
 source .venv/bin/activate


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to