diff --git a/docker/Dockerfile b/docker/Dockerfile new file mode 100644 index 000000000..476b266a4 --- /dev/null +++ b/docker/Dockerfile @@ -0,0 +1,46 @@ +# Build a docker image from latest YaCy sources + +# Base image : latest stable Debian +FROM debian:latest + +# Install needed packages +RUN apt-get update && apt-get install -yq \ + default-jdk \ + default-jre-headless \ + ant \ + git + +# set current working dir +WORKDIR /opt + +# clone main YaCy git repository (we need to clone git repository to generate correct version when building from source) +RUN git clone https://github.com/yacy/yacy_search_server.git + +# trace content of source directory +RUN ls -la /opt/yacy_search_server + +# set current working dir +WORKDIR /opt/yacy_search_server + +# Compile with ant +RUN ant compile + +# 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 + +# make some cleaning to reduce image size +RUN rm -rf .git \ + && apt-get purge -yq --auto-remove \ + default-jdk \ + ant \ + git \ + && apt-get clean + +# Expose port 8090 +EXPOSE 8090 + +# Set data volume : can be used to persist yacy data and configuration +VOLUME ["/opt/yacy_search_server/DATA"] + +# Start yacy ind debug mode (-d) to display console logs and to wait for yacy process +CMD sh /opt/yacy_search_server/startYACY.sh -d diff --git a/docker/Readme.md b/docker/Readme.md new file mode 100755 index 000000000..a49057d91 --- /dev/null +++ b/docker/Readme.md @@ -0,0 +1,67 @@ +# Yacy Docker image from latest sources + +[![Deploy to Docker Cloud](https://files.cloud.docker.com/images/deploy-to-dockercloud.svg)](https://cloud.docker.com/stack/deploy/?repo=https://github.com/luccioman/yacy_search_server/tree/docker/docker) + +## Getting built image from Docker Hub + + docker pull luccioman/yacy + +Repository URL : (https://hub.docker.com/r/luccioman/yacy/) + +## Building image yourself + +Using yacy_search_server/docker/Dockerfile : + + cd yacy_search_server/docker + docker build . + +## Default admin account + +login : admin + +password : docker + +You should modify this default password with page /ConfigAccounts_p.html when exposing publicly your YaCy container. + +## Usage + +### First start + +#### Most basic + + docker run luccioman/yacy + +YaCy web interface is then exposed at http://[container_ip]:8090. +You can retrieve the container IP address with `docker inspect`. + +#### Easier to handle + + docker run --name yacy -p 8090:8090 luccioman/yacy + +--name option allow easier management of your container (without it, docker automatically generate a new name at each startup). + +-p option map host port and container port, allowing web interface access through the usual http://localhost:8090. + +#### With persistent data volume + + docker run -v [your_host/data/directory]:/opt/yacy_search_server/DATA luccioman/yacy + +This allow your container to reuse a data directory form the host. + +#### As background process + + docker run -d luccioman/yacy + +### Next starts + +#### As attached process + + docker start -a yacy + +#### As background process + + docker start yacy + +### Shutdown + +* Use "Shutdown" button in administration web interface diff --git a/docker/docker-cloud.yml b/docker/docker-cloud.yml new file mode 100644 index 000000000..24a09a69b --- /dev/null +++ b/docker/docker-cloud.yml @@ -0,0 +1,6 @@ +yacy: + image: 'luccioman/yacy:latest' + ports: + - '8090:8090' + restart: on-failure + autoredeploy: true \ No newline at end of file