Repository navigation
Expand file tree
/
Copy pathDockerfile.ubuntu24.04
More file actions
201 lines (171 loc) · 8.23 KB
/
Copy pathDockerfile.ubuntu24.04
File metadata and controls
201 lines (171 loc) · 8.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
# Base image arguments
ARG BASE_REGISTRY=docker.io
ARG BASE_IMAGE=ubuntu
ARG BASE_TAG=24.04
ARG COPILOT_VERSION=latest
#global argument for tomcat
ARG TOMCAT_VERSION=11.0.29
# Which tomcat-builder variant to base on. Empty = the standard image; pass
# --build-arg TOMCAT_TAG_SUFFIX=-fips
# for the FIPS 140-3 variant. Only the SUFFIX crosses the workflow boundary, so
# TOMCAT_VERSION above stays the single source of truth for the version.
# A -fips base MUST be paired with SEMOSS_FIPS=true, or the war brings its own
# BouncyCastle into WEB-INF/lib beside the validated bc-fips and the result
# boots cleanly while being non-compliant.
ARG TOMCAT_TAG_SUFFIX=
ARG JAVA_HOME=/usr/lib/jvm/zulu25
ARG MAVEN_HOME=/opt/apache-maven-3.10.0
#setting up the tomcat builder for later below. this is for env var expansion.
FROM quay.io/semoss/tomcat-builder:${TOMCAT_VERSION}${TOMCAT_TAG_SUFFIX} AS tomcat_builder
ARG COPILOT_VERSION
# Provided automatically by buildx (amd64/arm64). Defaults to amd64 when building
# without buildx (TARGETARCH unset). copilot uses x64/arm64.
ARG TARGETARCH
RUN apt-get update -y \
&& apt-get install -y --no-install-recommends ca-certificates curl tar \
&& rm -rf /var/lib/apt/lists/* \
&& case "${TARGETARCH:-amd64}" in \
arm64) copilot_arch="arm64" ;; \
*) copilot_arch="x64" ;; \
esac \
&& tmp="$(mktemp -d)" \
&& case "${COPILOT_VERSION}" in \
latest) copilot_url="https://github.com/github/copilot-cli/releases/latest/download/copilot-linux-${copilot_arch}.tar.gz" ;; \
*) copilot_url="https://github.com/github/copilot-cli/releases/download/${COPILOT_VERSION}/copilot-linux-${copilot_arch}.tar.gz" ;; \
esac \
&& curl -fsSL -o "$tmp/copilot.tgz" "$copilot_url" \
&& tar -xzf "$tmp/copilot.tgz" -C "$tmp" \
&& install -m 0755 "$tmp/copilot" /usr/local/bin/copilot \
&& rm -rf "$tmp" \
&& chown 1001:0 /usr/local/bin/copilot
# FROM ${BASE_REGISTRY}/${BASE_IMAGE}:${BASE_TAG} AS base
FROM ${BASE_REGISTRY}/${BASE_IMAGE}:${BASE_TAG} AS mavenpuller
# Define environment variables in this stage
ARG TOMCAT_VERSION
ARG JAVA_HOME
ARG MAVEN_HOME
ARG SEMOSS_VERSION
# Selects the fips / libraries-fips Maven classifiers in
# update_latest_dev.sh. Must be true whenever TOMCAT_TAG is a -fips tag.
ARG SEMOSS_FIPS=false
ENV JAVA_HOME=${JAVA_HOME}
ENV TOMCAT_HOME=/opt/apache-tomcat-${TOMCAT_VERSION}
ENV MAVEN_HOME=${MAVEN_HOME}
ENV PATH=$PATH:$MAVEN_HOME/bin:$TOMCAT_HOME/bin:$JAVA_HOME/bin
ENV SEMOSS_VERSION=${SEMOSS_VERSION}
ENV SEMOSS_FIPS=${SEMOSS_FIPS}
ENV MAVEN_ARGS="-B -ntp"
ENV DEBIAN_FRONTEND=noninteractive
# Get tomcat, maven and java from another image called tomcat-builder
COPY --from=tomcat_builder /opt /opt
COPY --from=tomcat_builder /usr/lib/jvm/zulu25 /usr/lib/jvm/zulu25
RUN apt-get update -qq \
&& apt-get install -y -qq git curl unzip lsof \
&& mkdir /opt/semosshome \
&& cd /opt && git clone https://github.com/SEMOSS/semoss-artifacts \
&& chmod 777 /opt/semoss-artifacts/artifacts/scripts/*.sh \
&& /opt/semoss-artifacts/artifacts/scripts/update_latest_dev.sh \
&& rm -rf /root/.m2 \
&& chmod 777 /opt/semosshome/config/Chromedriver/* \
&& sed -i "s/tomcat.util.scan.StandardJarScanFilter.jarsToSkip=/tomcat.util.scan.StandardJarScanFilter.jarsToSkip=*.jar,/g" $TOMCAT_HOME/conf/catalina.properties;
RUN useradd -u 1001 -r -g 0 -d ${HOME} -s /bin/bash \
-c "Default Application User" default && \
chown -R 1001:0 ${HOME}
RUN mkdir /opt/chroot
RUN chown -R 1001:0 /opt
FROM ${BASE_REGISTRY}/${BASE_IMAGE}:${BASE_TAG} AS final
LABEL maintainer="semoss@semoss.org"
# From JAVA/tomcat
ARG TOMCAT_VERSION
ARG JAVA_HOME
ARG MAVEN_HOME
ENV JAVA_HOME=${JAVA_HOME}
ENV TOMCAT_VERSION=${TOMCAT_VERSION}
ENV TOMCAT_HOME=/opt/apache-tomcat-${TOMCAT_VERSION}
ENV VIRTUAL_ENV="/usr/lib/python/semossvenv"
ENV PATH=$VIRTUAL_ENV/bin:$PATH:$MAVEN_HOME/bin:$TOMCAT_HOME/bin:$JAVA_HOME/bin:/opt/semoss-artifacts/artifacts/scripts
ENV LANG=en_US.UTF-8
ENV LANGUAGE=en_US:en
ENV LC_ALL=en_US.UTF-8
COPY --from=tomcat_builder /usr/lib/jvm/zulu25 /usr/lib/jvm/zulu25
COPY --from=tomcat_builder /usr/local/bin/copilot /usr/local/bin/copilot
COPY --from=tomcat_builder /usr/bin/openshell /usr/local/bin/openshell
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update -qq \
&& apt-get install -y -qq git curl unzip lsof vim nano
RUN curl -fsSL https://rclone.org/install.sh | bash \
&& chmod 755 /usr/bin/rclone
## TODO - couldnt get the following to work
# RUN wget -q -O - https://dl.google.com/linux/linux_signing_key.pub | apt-key add - \
# && echo "deb http://dl.google.com/linux/chrome/deb/ stable main" | tee /etc/apt/sources.list.d/google-chrome.list \
# && apt-get update \
# && apt-get install -y google-chrome-stable bash
COPY --from=mavenpuller --chown=1001:0 /opt /opt
COPY --from=quay.io/semoss/python-builder:3.14-cpu /usr/lib/python /usr/lib/python
# ---------------------------------------------------------------------------
# Node.js runtime for the agent-only ExecuteNodeCode execution environment.
# NodeUtils resolves <NODE_HOME>/bin/node, so this must be a plain nodejs.org
# dist layout rather than a distro package. The curated js/node_env packages
# are installed at build time so the running container never needs npm or
# registry access (guarded: js/ only ships in the semosshome artifact once its
# assembly includes it). AGENT_DEFAULT_TOOLS_ENABLE_NODE is seeded false so
# the runtime env passthrough scripts have a line to sed, matching the other
# agent tool flags.
ARG NODE_VERSION=24.22.1
# The npm bundled with Node 24.22.1 (11.19.1) ships vulnerable brace-expansion,
# undici and http-cache-semantics. Track the newest 11.x (11.21.1+ bundles the
# fixed copies) so patch releases land on rebuild; pin an exact version to freeze.
ARG NPM_VERSION=11
ENV NODE_HOME=/opt/node
RUN set -eux; \
case "$(uname -m)" in \
x86_64) nodeArch=x64 ;; \
aarch64|arm64) nodeArch=arm64 ;; \
*) echo "unsupported architecture $(uname -m) for the node runtime"; exit 1 ;; \
esac; \
nodeTar="node-v${NODE_VERSION}-linux-${nodeArch}.tar.gz"; \
cd /tmp; \
curl -fsSLO "https://nodejs.org/dist/v${NODE_VERSION}/${nodeTar}"; \
curl -fsSL -o node-SHASUMS256.txt "https://nodejs.org/dist/v${NODE_VERSION}/SHASUMS256.txt"; \
grep " ${nodeTar}" node-SHASUMS256.txt | sha256sum -c -; \
mkdir -p "/opt/node-v${NODE_VERSION}"; \
tar -xzf "${nodeTar}" -C "/opt/node-v${NODE_VERSION}" --strip-components=1; \
ln -sfn "/opt/node-v${NODE_VERSION}" /opt/node; \
rm -f "${nodeTar}" node-SHASUMS256.txt; \
/opt/node/bin/node --version; \
PATH="/opt/node/bin:$PATH" /opt/node/bin/npm install -g "npm@${NPM_VERSION}" --no-audit --no-fund; \
PATH="/opt/node/bin:$PATH" /opt/node/bin/npm --version; \
if [ -f /opt/semosshome/js/node_env/package-lock.json ]; then \
cd /opt/semosshome/js/node_env; \
PATH="/opt/node/bin:$PATH" /opt/node/bin/npm ci --omit=dev --no-audit --no-fund; \
chown -R 1001:0 /opt/semosshome/js; \
fi; \
if ! grep -q "^AGENT_DEFAULT_TOOLS_ENABLE_NODE" /opt/semosshome/RDF_Map.prop; then \
printf 'AGENT_DEFAULT_TOOLS_ENABLE_NODE\tfalse\n' >> /opt/semosshome/RDF_Map.prop; \
fi
#LOCALE
RUN apt-get update -qq \
&& apt-get install -y -qq locales \
&& locale-gen en_US.UTF-8 \
&& dpkg-reconfigure --frontend=noninteractive locales \
&& locale -a
# Pulling files from the SEMOSS/semoss-artifacts folder
RUN cd /opt/semoss-artifacts \
&& chmod 777 artifacts/dockerBuilder_scripts/* \
&& cp ./artifacts/dockerBuilder_scripts/install_Playwright_linux_dependencies.sh /tmp/install_Playwright_linux_dependencies.sh \
&& cp ./artifacts/dockerBuilder_scripts/playwright-pom.xml /tmp/pom.xml
# Install playwright dependencies
RUN cd /tmp \
&& ./install_Playwright_linux_dependencies.sh \
&& rm -rf /root/.m2
RUN apt install -y debootstrap fakechroot fakeroot uidmap util-linux
# Bake the shared chroot template at build time (as root) so the running
# container never builds it. Writes /opt/chroot/.template/.ready, which makes
# ChrootTemplate.awaitReady() a no-op at startup. Auto-detects Ubuntu/RHEL paths.
RUN bash /opt/semoss-artifacts/artifacts/scripts/build_chroot_template.sh /opt/chroot
RUN useradd -u 1001 -r -g 0 -d ${HOME} -s /bin/bash \
-c "Default Application User" default && \
chown -R 1001:0 ${HOME}
USER 1001
WORKDIR /opt/semoss-artifacts/artifacts/scripts
CMD ["bash", "-c", "exec $TOMCAT_HOME/bin/start.sh" ]