Closed peponi closed 4 years ago
ah
and try to take debian:stretch-slim this will safe also some MB
and http://download.oracle.com/berkeley-db/db-4.8.30.tar.gz
should not be hard coded
move the url in a variable
ARG BERKLY_PKG_URL=http://download.oracle.com/berkeley-db/db-4.8.30.tar.gz
# Install Berkeley DB 4.8
RUN curl -L $BERKLY_PKG_URL | tar -xz -C /tmp && \
you can pass parameters to the docker build
command via --build-arg
docker build -t xsn-test-build --build-arg BERKLY_PKG_URL=http://download.oracle.com/berkeley-db/db-4.8.30.tar.gz .
Hi Sören
https://github.com/X9Developers/XSN/blob/7fe0dae12f747e4b157a72b5f1123cd61c2c95ba/Dockerfile#L39
this will not work, if you want to save image sizes because Docker images are composed in layers
every RUN command is one layer and will be safed (like in git)
you need to COPY first and merge the RUN commands in to one big command then you can
apt remove
the packages as last (all in the same Docker layer)SECOND OPTION (better)
install and compile all in an build layer
https://docs.docker.com/develop/develop-images/multistage-build/#use-multi-stage-builds
notice
COPY --from=0 /go/src/github.com/alexellis/href-counter/app .
you will copy the compiled files to a clean new image and the build layer will be erased
CLI TOOLS TO RESCUE