Skip to content
Permalink
Browse files

Merge pull request #220 from pnhofmann/master

Improve Dockerfile
  • Loading branch information...
luccioman committed Aug 25, 2018
2 parents 1b866c6 + 04c9584 commit a8078c22e48afe873b9037822fb298831dd05015
Showing with 24 additions and 29 deletions.
  1. +13 −14 docker/Dockerfile
  2. +11 −15 docker/Dockerfile.alpine
  3. 0 docker/Readme.md
@@ -1,14 +1,15 @@
# Build a docker image from latest YaCy sources

# Base image : latest stable official jdk image from Docker (Debian based)
# Base image : latest stable official jdk image from Docker (Debian based)
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

# set current working dir
WORKDIR /opt

@@ -27,21 +28,19 @@ RUN apt-get update && \
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 && \
apt-get purge -yq --auto-remove ant git && \
apt-get clean

apt-get purge -yq --auto-remove ant git && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*

RUN \
# 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

sed -i "/adminAccountBase64MD5=/c\adminAccountBase64MD5=MD5:e672161ffdce91be4678605f4f4e6786" /opt/yacy_search_server/defaults/yacy.init && \
# Intially enable HTTPS : this is the most secure option for remote administrator authentication
RUN sed -i "/server.https=false/c\server.https=true" /opt/yacy_search_server/defaults/yacy.init

sed -i "/server.https=false/c\server.https=true" /opt/yacy_search_server/defaults/yacy.init && \
# Create user and group yacy : this user will be used to run YaCy main process
RUN adduser --system --group --no-create-home --disabled-password yacy

adduser --system --group --no-create-home --disabled-password yacy && \
# Set ownership of yacy install directory to yacy user/group
RUN chown yacy:yacy -R /opt/yacy_search_server
chown yacy:yacy -R /opt/yacy_search_server

# Expose HTTP and HTTPS default ports
EXPOSE 8090 8443
26 docker/Dockerfile.alpine 100755 → 100644
@@ -1,14 +1,13 @@
# Build a docker image from latest YaCy sources on Alpine Linux

# Base image : latest stable official jdk image from Docker based on Alpine Linux
# Base image : latest stable official jdk image from Docker based on Alpine Linux
FROM openjdk:alpine

# trace java version
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
@@ -35,11 +34,11 @@ RUN apk update && \
mv apache-ant-${ANT_VERSION} /opt/ant && \
rm -f apache-ant-${ANT_VERSION}-bin.tar.gz && \
apk del gnupg

# set ant required environment variables
ENV ANT_HOME /opt/ant
ENV ANT_HOME /opt/ant
ENV PATH ${PATH}:/opt/ant/bin

# --- End of apache ant install

# set current working dir
@@ -55,25 +54,22 @@ 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 && \
rm -rf /opt/ant && \
apk del git

RUN \
# 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

sed -i "/adminAccountBase64MD5=/c\adminAccountBase64MD5=MD5:e672161ffdce91be4678605f4f4e6786" /opt/yacy_search_server/defaults/yacy.init && \
# Intially enable HTTPS : this is the most secure option for remote administrator authentication
RUN sed -i "/server.https=false/c\server.https=true" /opt/yacy_search_server/defaults/yacy.init

sed -i "/server.https=false/c\server.https=true" /opt/yacy_search_server/defaults/yacy.init && \
# Create user and group yacy : this user will be used to run YaCy main process
RUN addgroup yacy && adduser -S -G yacy -H -D yacy

addgroup yacy && adduser -S -G yacy -H -D yacy && \
# Set ownership of yacy install directory to yacy user/group
RUN chown yacy:yacy -R /opt/yacy_search_server
chown yacy:yacy -R /opt/yacy_search_server

# Expose HTTP and HTTPS default ports
EXPOSE 8090 8443
0 docker/Readme.md 100755 → 100644
No changes.

0 comments on commit a8078c2

Please sign in to comment.
You can’t perform that action at this time.