Skip to content

Commit 1a151e3

Browse files
authored
Docker: Move out step to fetch external jars for SessionMap from Base (#2909)
Signed-off-by: Viet Nguyen Duc <nguyenducviet4496@gmail.com>
1 parent feee006 commit 1a151e3

File tree

3 files changed

+17
-12
lines changed

3 files changed

+17
-12
lines changed

Base/Dockerfile

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,11 @@ LABEL org.opencontainers.image.source="https://github.com/${AUTHORS}/docker-sele
66
# Arguments to define the version of dependencies to download
77
ARG VERSION
88
ARG RELEASE=selenium-${VERSION}
9-
ARG MVN_SELENIUM_VERSION
109
# Default value should be aligned with upstream Selenium (https://github.com/SeleniumHQ/selenium/blob/trunk/MODULE.bazel)
1110
ARG OPENTELEMETRY_VERSION=1.51.0
1211
ARG GRPC_VERSION=1.73.0
1312
ARG NETTY_VERSION=4.1.122.Final
1413
ARG CS_VERSION=2.1.24
15-
ARG POSTGRESQL_VERSION=42.7.7
1614
ARG ENVSUBST_VERSION=1.4.5
1715

1816
#Arguments to define the user running Selenium
@@ -148,14 +146,7 @@ RUN --mount=type=secret,id=SEL_PASSWD \
148146
io.netty:netty-handler:${NETTY_VERSION} \
149147
io.netty:netty-common:${NETTY_VERSION} \
150148
> /external_jars/.classpath.txt \
151-
&& chmod 664 /external_jars/.classpath.txt \
152-
&& java -jar /tmp/cs fetch --classpath --cache /external_jars \
153-
org.seleniumhq.selenium:selenium-session-map-jdbc:${MVN_SELENIUM_VERSION} \
154-
org.postgresql:postgresql:${POSTGRESQL_VERSION} \
155-
org.seleniumhq.selenium:selenium-session-map-redis:${MVN_SELENIUM_VERSION} \
156-
# Patch specific version for CVEs in the dependencies
157-
> /external_jars/.classpath_session_map.txt \
158-
&& chmod 664 /external_jars/.classpath_session_map.txt ; \
149+
&& chmod 664 /external_jars/.classpath.txt ; \
159150
fi \
160151
&& rm -fr /root/.cache/* \
161152
# (Note that .bashrc is only executed in interactive bash shells.)

Makefile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ gen_certs:
131131

132132
base: prepare_resources gen_certs
133133
cd ./Base && SEL_PASSWD=$(SEL_PASSWD) docker buildx build --platform $(PLATFORMS) $(BUILD_ARGS) --build-arg VERSION=$(BASE_VERSION) --build-arg RELEASE=$(BASE_RELEASE) --build-arg AUTHORS=$(AUTHORS) \
134-
--build-arg MVN_SELENIUM_VERSION=$(MVN_SELENIUM_VERSION) --secret id=SEL_PASSWD --sbom=true --attest type=provenance,mode=max -t $(NAME)/base:$(TAG_VERSION) .
134+
--secret id=SEL_PASSWD --sbom=true --attest type=provenance,mode=max -t $(NAME)/base:$(TAG_VERSION) .
135135

136136
base_nightly:
137137
BASE_VERSION=$(BASE_VERSION_NIGHTLY) BASE_RELEASE=$(BASE_RELEASE_NIGHTLY) make base
@@ -146,7 +146,8 @@ router: base
146146
cd ./Router && docker buildx build --platform $(PLATFORMS) $(BUILD_ARGS) $(FROM_IMAGE_ARGS) -t $(NAME)/router:$(TAG_VERSION) .
147147

148148
sessions: base
149-
cd ./Sessions && docker buildx build --platform $(PLATFORMS) $(BUILD_ARGS) $(FROM_IMAGE_ARGS) -t $(NAME)/sessions:$(TAG_VERSION) .
149+
cd ./Sessions && docker buildx build --platform $(PLATFORMS) $(BUILD_ARGS) $(FROM_IMAGE_ARGS) \
150+
--build-arg MVN_SELENIUM_VERSION=$(MVN_SELENIUM_VERSION) -t $(NAME)/sessions:$(TAG_VERSION) .
150151

151152
sessionqueue: base
152153
cd ./SessionQueue && docker buildx build --platform $(PLATFORMS) $(BUILD_ARGS) $(FROM_IMAGE_ARGS) -t $(NAME)/session-queue:$(TAG_VERSION) .

Sessions/Dockerfile

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,26 @@ ARG VERSION=latest
33
FROM ${NAMESPACE}/base:${VERSION}
44
ARG AUTHORS
55
LABEL authors=${AUTHORS}
6+
ARG MVN_SELENIUM_VERSION
7+
ARG POSTGRESQL_VERSION=42.7.7
68

79
#========================
810
# Selenium SessionMap Configuration
911
#========================
1012

1113
USER root
1214

15+
RUN if [ -f "/tmp/cs" ]; then \
16+
java -jar /tmp/cs fetch --classpath --cache /external_jars \
17+
org.seleniumhq.selenium:selenium-session-map-jdbc:${MVN_SELENIUM_VERSION} \
18+
org.postgresql:postgresql:${POSTGRESQL_VERSION} \
19+
org.seleniumhq.selenium:selenium-session-map-redis:${MVN_SELENIUM_VERSION} \
20+
# Patch specific version for CVEs in the dependencies
21+
> /external_jars/.classpath_session_map.txt \
22+
&& chmod 664 /external_jars/.classpath_session_map.txt ; \
23+
fi \
24+
&& rm -fr /root/.cache/*
25+
1326
COPY --chown="${SEL_UID}:${SEL_GID}" start-selenium-grid-sessions.sh generate_config \
1427
/opt/bin/
1528
RUN chmod +x /opt/bin/start-selenium-grid-sessions.sh /opt/bin/generate_config

0 commit comments

Comments
 (0)