Reduce Docker image size

* Remove apk cache after installing packages
* Remove unused Redis binaries: -benchmark and -cli

Those have to be done on the same line as `apk add` in order to be part
of the same image layer, since running them in a separate layer would
not affect the layer they were added to.
master
Nicolas Favre-Felix 3 years ago
parent 2758fc0337
commit 545c56c4cb
No known key found for this signature in database
GPG Key ID: C04E7AA8B6F73372

@ -11,7 +11,7 @@ RUN sed -i -e 's/"daemonize":.*true,/"daemonize": false,/g' /etc/webdis.prod.jso
# main image # main image
FROM alpine:3.14.3 FROM alpine:3.14.3
# Required dependencies, with versions fixing known security vulnerabilities # Required dependencies, with versions fixing known security vulnerabilities
RUN apk update && apk add libevent msgpack-c 'redis>6.2.6' openssl libssl1.1 libcrypto1.1 RUN apk update && apk add libevent msgpack-c 'redis>6.2.6' openssl libssl1.1 libcrypto1.1 && rm -f /var/cache/apk/* /usr/bin/redis-benchmark /usr/bin/redis-cli
COPY --from=stage /usr/local/bin/webdis /usr/local/bin/webdis-ssl /usr/local/bin/ COPY --from=stage /usr/local/bin/webdis /usr/local/bin/webdis-ssl /usr/local/bin/
COPY --from=stage /etc/webdis.prod.json /etc/webdis.prod.json COPY --from=stage /etc/webdis.prod.json /etc/webdis.prod.json
RUN echo "daemonize yes" >> /etc/redis.conf RUN echo "daemonize yes" >> /etc/redis.conf

Loading…
Cancel
Save