-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.java21
More file actions
44 lines (34 loc) · 1.23 KB
/
Dockerfile.java21
File metadata and controls
44 lines (34 loc) · 1.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
# Jenkins Script Library Testing Image (Java 21)
#
# This Dockerfile creates an environment for testing the Jenkins Script Library
# with Java 21. It includes Gradle and all necessary testing tools.
FROM eclipse-temurin:25-jdk
# Set environment variables
ENV GRADLE_VERSION=8.14.2
# Install required packages
RUN apt-get update && apt-get install -y \
curl \
unzip \
git \
wget \
jq \
gosu \
&& rm -rf /var/lib/apt/lists/*
# Install Gradle
RUN wget -q https://services.gradle.org/distributions/gradle-${GRADLE_VERSION}-bin.zip -O /tmp/gradle.zip \
&& unzip /tmp/gradle.zip -d /opt \
&& ln -s /opt/gradle-${GRADLE_VERSION} /opt/gradle \
&& rm /tmp/gradle.zip
# Add to PATH
ENV PATH="$PATH:/opt/gradle/bin"
# Create directories with appropriate permissions
RUN mkdir -p /app/build/reports /app/build/test-results /app/.gradle && \
chmod -R 777 /app/build /app/.gradle
WORKDIR /app
# Create an entrypoint script to handle permissions and user setup
COPY entrypoint-test.sh /usr/local/bin/entrypoint.sh
RUN chmod +x /usr/local/bin/entrypoint.sh
# Define an entrypoint that handles permissions
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
# Default command runs the tests
CMD ["./gradlew", "test", "--no-daemon"]