First off, thank you for adding the Docker section to the installation guide. It's quite helpful!
Since wget is no longer included in node:12-buster-slim or any of the newest -slim images (https://github.com/nodejs/docker-node/issues/1185), this section could use a change to either install wget or to use the full image rather than slim.
@GaryGSC thanks for the comment.
I guess I also need to update https://blogs.oracle.com/opal/docker-for-oracle-database-applications-in-nodejs-and-python-part-1 (and I haven't got part 2 finished yet!)
I suggest using the ADD directive instead of using wget / curl inside the container:
ADD https://download.oracle.com/otn_software/linux/instantclient/instantclient-basiclite-linuxx64.zip /tmp/instantclient-basiclite.zip
@sosoba I read in https://docs.docker.com/develop/develop-images/dockerfile_best-practices/#add-or-copy "Because image size matters, using ADD to fetch packages from remote URLs is strongly discouraged; you should use curl or wget instead." Does your experience differ?
In practice it's probably better to download Instant Client to the machine running Docker, and just add the files into the image. This way there is no repeated download cost.
I didn't notice the difference. Maybe it's a warning against using COPY / ADD with an asterisk? BTW the best solution is mulliayer Dockerfile which "reset" layers and copy only needed files:
ARG NODE_VERSION=13.8.0
FROM node:${NODE_VERSION}-stretch-slim AS build-env
ADD https://download.oracle.com/otn_software/linux/instantclient/195000/instantclient-basiclite-linux.x64-19.5.0.0.0dbru.zip /tmp/instantclient-basiclite.zip
RUN apt-get update \
&& apt-get install -y libaio1 bsdtar \
&& apt-get clean \
&& mkdir /opt/instantclient \
&& bsdtar --strip-components=1 -xvf /tmp/instantclient-basiclite.zip -C /opt/instantclient \
&& cd /opt/instantclient \
&& rm -f *jdbc* *occi* *mysql* *jar uidrvci genezi adrci libipc1.so libmql1.so
FROM node:${NODE_VERSION}-stretch-slim
COPY --from=build-env /opt/instantclient/ /opt/instantclient/
COPY --from=build-env /lib/x86_64-linux-gnu/libaio.so.1 /lib/x86_64-linux-gnu/libaio.so.1
ENV LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/instantclient
Thanks for sharing. I had one multistage builder example in my blog post.
With your Dockerfile, I'd probably make it a more generic example and use ldconfig instead of setting LD_LIBRARY_PATH; for other uses setting the env var can be error prone e.g. when subshells start with clean environments.
@GaryGSC I updated the 5.0 doc on the master branch; it will become production documentation when 5.0 is released.
I'll close this now. Thanks for the report.
Most helpful comment
I suggest using the ADD directive instead of using wget / curl inside the container: