Skip to content

Commit 28c3bb0

Browse files
committed
basic-server: build a container for simple testing
Motivation: In some dev environments running a container is the preferred way, so, let provide one. Modification: Introduce multi-stage container for small image. Result: ```bash podman run -p 2049:2049 --name nfs-server docker.io/dcache/nfs4j-server:latest ``` Acked-by: Lea Morschel Target: master
1 parent e77f5ad commit 28c3bb0

File tree

3 files changed

+63
-0
lines changed

3 files changed

+63
-0
lines changed

basic-server/pom.xml

+29
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,35 @@
4545
</execution>
4646
</executions>
4747
</plugin>
48+
49+
<plugin>
50+
<groupId>io.fabric8</groupId>
51+
<artifactId>docker-maven-plugin</artifactId>
52+
<version>0.45.1</version>
53+
<configuration>
54+
<images>
55+
<image>
56+
<name>%g/nfs4j-server:%l</name>
57+
<build>
58+
<dockerFile>${project.basedir}/src/main/container/Dockerfile</dockerFile>
59+
<assembly>
60+
<descriptorRef>artifact-with-dependencies</descriptorRef>
61+
</assembly>
62+
</build>
63+
</image>
64+
</images>
65+
</configuration>
66+
<executions>
67+
<execution>
68+
<id>build</id>
69+
<phase>install</phase>
70+
<goals>
71+
<goal>build</goal>
72+
</goals>
73+
</execution>
74+
</executions>
75+
</plugin>
76+
4877
</plugins>
4978
</build>
5079

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
FROM almalinux:9-minimal as builder
2+
3+
# Add JRE
4+
RUN microdnf -y install java-17-openjdk-devel java-17-openjdk-jmods binutils
5+
RUN jlink -v --compress=2 --strip-debug --no-header-files --no-man-pages --add-modules java.base,java.compiler,java.instrument,java.logging,java.management,java.naming,java.security.jgss,java.transaction.xa,java.xml,jdk.jfr,jdk.security.auth,jdk.unsupported --output /jlink-runtime
6+
7+
8+
FROM almalinux:9-minimal
9+
COPY --from=builder /jlink-runtime /jlink-runtime
10+
11+
# add external files into container at the build time
12+
COPY run.sh /run.sh
13+
RUN chmod +x /run.sh
14+
15+
# where we store the data
16+
RUN mkdir -p /usr/share/nfs4j
17+
18+
# Add JARS
19+
COPY maven /usr/share/nfs4j/jars
20+
21+
22+
# Post-install brutal cleanup
23+
RUN microdnf clean all && rm -rf /var/cache/yum /var/lib/dnf /var/lib/rpm
24+
25+
# expose TCP ports for network services
26+
EXPOSE 2049
27+
28+
# by default we start server
29+
CMD ["/run.sh"]
+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/bin/sh
2+
3+
exec /jlink-runtime/bin/java \
4+
${JAVA_OPT} ${JMX} ${JAVA_ARGS} \
5+
-cp "/usr/share/nfs4j/jars/*" org.dcache.nfs4j.server.Main "$@"

0 commit comments

Comments
 (0)