Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch to multi-stage build #8

Open
johnnyfleet opened this issue May 3, 2021 · 2 comments
Open

Switch to multi-stage build #8

johnnyfleet opened this issue May 3, 2021 · 2 comments

Comments

@johnnyfleet
Copy link
Owner

The docker file adds some programs (curl) to simply build the image which makes the overall size larger than needed and less secure (stuff running which isn't needed).

We should move to multi-stage builds. see here (under use JRE not JDK) for example for how to use multi-stage builds.

@johnnyfleet
Copy link
Owner Author

johnnyfleet commented Jan 5, 2022

Saw this issue with some good example of multi-stage build:

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

@johnnyfleet
Copy link
Owner Author

Some additional ideas (also linking into GraalVM): https://www.batey.info/graalvm-native-image-docker-multipart-build.html?utm_source=pocket_mylist

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant