Reputation: 317
I need to COPY a native library to docker image's /usr/lib directory. My Quarkus project is in IntelliJ and I have tried putting this binary .so file in target/resources folder and modified the Dockerfile.jvm as follows but the file was not copied. Below are the contents of the Dockerfile that Quarkus generated during skaffolding, I added one line to COPY section:
FROM registry.access.redhat.com/ubi8/ubi-minimal:8.1
ARG JAVA_PACKAGE=java-11-openjdk-headless
ARG RUN_JAVA_VERSION=1.3.8
ENV LANG='en_US.UTF-8' LANGUAGE='en_US:en'
# Install java and the run-java script
# Also set up permissions for user `1001`
RUN microdnf install curl ca-certificates ${JAVA_PACKAGE} \
&& microdnf update \
&& microdnf clean all \
&& mkdir /deployments \
&& chown 1001 /deployments \
&& chmod "g+rwX" /deployments \
&& chown 1001:root /deployments \
&& curl https://repo1.maven.org/maven2/io/fabric8/run-java-
sh/${RUN_JAVA_VERSION}/run-java-sh-${RUN_JAVA_VERSION}-sh.sh -o
/deployments/run-java.sh \
&& chown 1001 /deployments/run-java.sh \
&& chmod 540 /deployments/run-java.sh \
&& echo "securerandom.source=file:/dev/urandom" >>
/etc/alternatives/jre/lib/security/java.security
ENV JAVA_OPTIONS="-Dquarkus.http.host=0.0.0.0
-Djava.util.logging.manager=org.jboss.logmanager.LogManager"
COPY target/lib/* /deployments/lib/
COPY target/*-runner.jar /deployments/app.jar
#below is the only change I made #
COPY target/resources/calc.so /usr/lib/
#end of my change #
EXPOSE 8080
USER 1001
ENTRYPOINT [ "/deployments/run-java.sh" ]
I also tried running at my project root
docker build -f src/main/docker/Dockerfile.jvm -t mylogin/demo:1.0-SNAPSHOT .
I get an error :
COPY failed: stat /var/lib/docker/tmp/docker-builder707527817/target/resources/calc.so: no such file or directory
Any help is much appreciated.
Thanks
Upvotes: 0
Views: 2268
Reputation: 317
It was the .dockerIgnore file auto-generated when I skaffolded Quarkus application. Make sure it allows copying all the file types you need to copy. Thanks.
Upvotes: 6