Dockerfile: Improve package cache update

* Alpine-Image: If --no-cache is used, apk update is not necessary
* Debian-Image: Remove /var/lib/apt/lists to reduce image size
This commit is contained in:
Philipp Hofmann 2018-08-20 14:42:20 +02:00
parent 3f2a2f7577
commit 42734175c8
2 changed files with 6 additions and 7 deletions

View File

@ -4,7 +4,8 @@
FROM openjdk:latest
# Install needed packages not in base image
RUN apt-get update && apt-get install -yq curl
RUN apt-get update && apt-get install -yq curl && \
rm -rf /var/lib/apt/lists/*
# trace java version
RUN java -version
@ -28,8 +29,8 @@ RUN apt-get update && \
ant compile -f /opt/yacy_search_server/build.xml && \
rm -rf /opt/yacy_search_server/.git && \
apt-get purge -yq --auto-remove ant git && \
apt-get clean
apt-get clean && \
rm -rf /var/lib/apt/lists/*
# Set initial admin password : "docker" (encoded with custom yacy md5 function net.yacy.cora.order.Digest.encodeMD5Hex())
RUN sed -i "/adminAccountBase64MD5=/c\adminAccountBase64MD5=MD5:e672161ffdce91be4678605f4f4e6786" /opt/yacy_search_server/defaults/yacy.init

View File

@ -7,8 +7,7 @@ FROM openjdk:alpine
RUN java -version
# Install needed packages not in base image
RUN apk update && \
apk add --no-cache curl
RUN apk add --no-cache curl
# set current working dir
WORKDIR /tmp
@ -55,8 +54,7 @@ WORKDIR /opt
# Possible alternative : copy directly your current sources an remove git clone command from the following RUN
# COPY . /opt/yacy_search_server/
RUN apk update && \
apk add --no-cache git && \
RUN apk add --no-cache git && \
git clone https://github.com/yacy/yacy_search_server.git && \
ant compile -f /opt/yacy_search_server/build.xml && \
rm -rf /opt/yacy_search_server/.git && \