From 5f3d4d7b7e0f5a6d93f4d711969719699a3f4721 Mon Sep 17 00:00:00 2001 From: Mister_X Date: Wed, 2 Apr 2025 01:43:32 +0200 Subject: fix docker --- docker/Dockerfile | 2 +- docker/Dockerfile.alpine | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'docker') diff --git a/docker/Dockerfile b/docker/Dockerfile index c2f90c41c..25b9a0041 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -7,7 +7,7 @@ # docker run -d --name yacy -p 8090:8090 -p 8443:8443 -v yacy_data:/opt/yacy_search_server/DATA --log-opt max-size=200m --log-opt max-file=2 yacy/yacy_search_server:latest ## build base -FROM eclipse-temurin:11-jdk-jammy AS base +FROM eclipse-temurin:17 AS base RUN apt-get update && apt-get install -yq wkhtmltopdf imagemagick xvfb ghostscript && rm -rf /var/lib/apt/lists/* ## build app diff --git a/docker/Dockerfile.alpine b/docker/Dockerfile.alpine index 627b5f0ef..f5e973fd0 100644 --- a/docker/Dockerfile.alpine +++ b/docker/Dockerfile.alpine @@ -1,7 +1,7 @@ # Build a docker image from latest YaCy sources on Alpine Linux # Base image : latest stable official jdk 11 image from Docker based on Alpine Linux -FROM openjdk:11-alpine +FROM eclipse-temurin:17-alpine # trace java version RUN java -version -- cgit v1.2.3 From 557ceffb5ef8c097c79088a2710e6cb48f8103cd Mon Sep 17 00:00:00 2001 From: Mister_X Date: Wed, 2 Apr 2025 02:00:36 +0200 Subject: fix docker --- docker/Dockerfile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'docker') diff --git a/docker/Dockerfile b/docker/Dockerfile index 25b9a0041..e200c9447 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -25,9 +25,9 @@ RUN ant compile -f /opt/yacy_search_server/build.xml && \ rm -rf /var/lib/apt/lists/* WORKDIR /opt/yacy_search_server/ -RUN git rev-parse HEAD > .git/shallow && \ - git tag -l | xargs git tag -d && \ - git gc --prune=now +#RUN git rev-parse HEAD > .git/shallow && \ +# git tag -l | xargs git tag -d && \ +# git gc --prune=now # Set initial admin password: "yacy" (encoded with custom yacy md5 function net.yacy.cora.order.Digest.encodeMD5Hex()) RUN sed -i "/adminAccountBase64MD5=/c\adminAccountBase64MD5=MD5:8cffbc0d66567a0987a4aba1ec46d63c" /opt/yacy_search_server/defaults/yacy.init && \ -- cgit v1.2.3 From 09e60ea5c9e4d3028c06889e913d4b7188d72a2d Mon Sep 17 00:00:00 2001 From: Mister_X Date: Wed, 2 Apr 2025 02:09:10 +0200 Subject: simplify alpine image --- docker/Dockerfile.alpine | 74 ++---------------------------------------------- 1 file changed, 3 insertions(+), 71 deletions(-) (limited to 'docker') diff --git a/docker/Dockerfile.alpine b/docker/Dockerfile.alpine index f5e973fd0..e0369fb1a 100644 --- a/docker/Dockerfile.alpine +++ b/docker/Dockerfile.alpine @@ -7,84 +7,16 @@ FROM eclipse-temurin:17-alpine RUN java -version # Install needed packages not in base image -# (curl for sh scripts in /bin, and imagemagick,xvfb and ghostscript to enable PDF and image snapshot generation) -RUN apk add --no-cache curl imagemagick xvfb ghostscript - -# --- Begin of wkhtmltopdf install : compile from sources because the wkhtmltopdf Alpine package is currently only on the Alpine edge branch - -# set current working dir -WORKDIR /tmp - -# set wkhtmltopdf version once in a environment variable -ENV WKHTMLTOPDF_VERSION 0.12.5 - -# Download and extract wkhtmltopdf sources -RUN curl -fSL https://github.com/wkhtmltopdf/wkhtmltopdf/archive/${WKHTMLTOPDF_VERSION}.tar.gz -o wkhtmltopdf-${WKHTMLTOPDF_VERSION}-src.tar.gz && \ - tar xzf wkhtmltopdf-${WKHTMLTOPDF_VERSION}-src.tar.gz - -# set current working dir -WORKDIR wkhtmltopdf-${WKHTMLTOPDF_VERSION} - -# All in one step to reduce image size growth : -# - add packages necessary to build wkhtmltopdf from sources and then to run it -# - build wkhtmltopdf -# - create a symbolic link to the wkhtmltopdf executable at a path where YaCy is expecting it -# - remove the sources archive -# - remove the build packages -RUN apk update && \ - apk add --no-cache g++ make qt5-qtbase-dev qt5-qtwebkit-dev qt5-qtsvg-dev qt5-qtxmlpatterns-dev libgcc libstdc++ musl qt5-qtbase qt5-qtbase-x11 qt5-qtsvg qt5-qtwebkit && \ - qmake-qt5 -makefile && \ - make && \ - make install && \ - rm -f /tmp/wkhtmltopdf-${WKHTMLTOPDF_VERSION}-src.tar.gz && \ - apk del g++ make qt5-qtbase-dev qt5-qtwebkit-dev qt5-qtsvg-dev qt5-qtxmlpatterns-dev - -# --- End of wkhtmltopdf install - -# --- Begin of apache ant install : from binary distribution because ant is not in alpine packages - -# set current working dir -WORKDIR /tmp - -# set ant version once in a environment variable -ENV ANT_VERSION 1.10.5 - -# All in one step to reduce image size growth : -# - add gnupg package -# - get ant binary file from a mirror and PGP file signature from main repository -# - import gpg keys from main repository and verify binary file signature -# - extract binary, make /opt directory, move extracted ant to /opt/ant -# - remove archive and gnupg package -RUN apk update && \ - apk add --no-cache gnupg && \ - curl -fSL https://archive.apache.org/dist/ant/binaries/apache-ant-${ANT_VERSION}-bin.tar.gz -o apache-ant-${ANT_VERSION}-bin.tar.gz && \ - curl -fSL https://archive.apache.org/dist/ant/binaries/apache-ant-${ANT_VERSION}-bin.tar.gz.asc -o apache-ant-${ANT_VERSION}-bin.tar.gz.asc && \ - curl -fSL https://www.apache.org/dist/ant/KEYS | gpg --import && \ - gpg --verify apache-ant-${ANT_VERSION}-bin.tar.gz.asc && \ - tar xzf apache-ant-${ANT_VERSION}-bin.tar.gz && \ - mkdir -p /opt && \ - 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 PATH ${PATH}:/opt/ant/bin - -# --- End of apache ant install +# (curl for sh scripts in /bin, imagemagick, xvfb, ghostscript, wkhtmltopdf, and apache-ant for building) +RUN apk add --no-cache curl imagemagick xvfb ghostscript wkhtmltopdf apache-ant # set current working dir WORKDIR /opt -# All in one step to reduce image size growth : -# - compile with apache ant -# - delete ant binary install - # copy sources COPY . /opt/yacy_search_server/ -RUN apk add --no-cache \ - ant compile -f /opt/yacy_search_server/build.xml && \ +RUN ant compile -f /opt/yacy_search_server/build.xml && \ rm -rf /opt/yacy_search_server/.git && \ rm -rf /opt/ant -- cgit v1.2.3 From 3dfcb2bdfd5a431fed54c9fc4f272f346ff64e1c Mon Sep 17 00:00:00 2001 From: Mister_X Date: Wed, 2 Apr 2025 02:21:16 +0200 Subject: fix alpine docker --- .github/workflows/build-docker-image.yaml | 2 +- docker/Dockerfile.alpine | 34 +++++++++++++++++++++++++++++-- 2 files changed, 33 insertions(+), 3 deletions(-) (limited to 'docker') diff --git a/.github/workflows/build-docker-image.yaml b/.github/workflows/build-docker-image.yaml index d7048047b..3f8de5c51 100644 --- a/.github/workflows/build-docker-image.yaml +++ b/.github/workflows/build-docker-image.yaml @@ -23,7 +23,7 @@ jobs: - tag: "" # Default Dockerfile platforms: linux/amd64,linux/arm64 - tag: alpine - platforms: linux/amd64 + platforms: linux/amd64,linux/arm64 runs-on: ubuntu-latest steps: diff --git a/docker/Dockerfile.alpine b/docker/Dockerfile.alpine index e0369fb1a..1a9e8a95e 100644 --- a/docker/Dockerfile.alpine +++ b/docker/Dockerfile.alpine @@ -1,14 +1,44 @@ # Build a docker image from latest YaCy sources on Alpine Linux # Base image : latest stable official jdk 11 image from Docker based on Alpine Linux -FROM eclipse-temurin:17-alpine +FROM surnet/alpine-wkhtmltopdf:3.21.2-0.12.6-full as wkhtmltopdf +FROM eclipse-temurin:21-alpine-3.21 # trace java version RUN java -version +# Install dependencies for wkhtmltopdf +RUN apk add --no-cache \ + libstdc++ \ + libx11 \ + libxrender \ + libxext \ + libssl3 \ + ca-certificates \ + fontconfig \ + freetype \ + ttf-dejavu \ + ttf-droid \ + ttf-freefont \ + ttf-liberation \ + # more fonts + && apk add --no-cache --virtual .build-deps \ + msttcorefonts-installer \ + # Install microsoft fonts + && update-ms-fonts \ + && fc-cache -f \ + # Clean up when done + && rm -rf /tmp/* \ + && apk del .build-deps + +# Copy wkhtmltopdf files from docker-wkhtmltopdf image +COPY --from=wkhtmltopdf /bin/wkhtmltopdf /bin/wkhtmltopdf +COPY --from=wkhtmltopdf /bin/wkhtmltoimage /bin/wkhtmltoimage +COPY --from=wkhtmltopdf /lib/libwkhtmltox* /lib/ + # Install needed packages not in base image # (curl for sh scripts in /bin, imagemagick, xvfb, ghostscript, wkhtmltopdf, and apache-ant for building) -RUN apk add --no-cache curl imagemagick xvfb ghostscript wkhtmltopdf apache-ant +RUN apk add --no-cache curl imagemagick xvfb ghostscript apache-ant # set current working dir WORKDIR /opt -- cgit v1.2.3 From 739d321111362a2e8859c474fe5eadae79dd9e90 Mon Sep 17 00:00:00 2001 From: Mister_X Date: Wed, 2 Apr 2025 02:26:13 +0200 Subject: fix alpine docker --- docker/Dockerfile.alpine | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'docker') diff --git a/docker/Dockerfile.alpine b/docker/Dockerfile.alpine index 1a9e8a95e..d3618a3a1 100644 --- a/docker/Dockerfile.alpine +++ b/docker/Dockerfile.alpine @@ -38,7 +38,7 @@ COPY --from=wkhtmltopdf /lib/libwkhtmltox* /lib/ # Install needed packages not in base image # (curl for sh scripts in /bin, imagemagick, xvfb, ghostscript, wkhtmltopdf, and apache-ant for building) -RUN apk add --no-cache curl imagemagick xvfb ghostscript apache-ant +RUN apk add --no-cache curl git imagemagick xvfb ghostscript apache-ant # set current working dir WORKDIR /opt -- cgit v1.2.3 From e3a40771e55089606e1b5c35015eaaff9258318c Mon Sep 17 00:00:00 2001 From: Mister_X Date: Wed, 2 Apr 2025 02:35:28 +0200 Subject: update main dockerfile to jdk 21 --- docker/Dockerfile | 3 +-- docker/Dockerfile.alpine | 58 ++++++++++++++++++++++-------------------------- 2 files changed, 28 insertions(+), 33 deletions(-) (limited to 'docker') diff --git a/docker/Dockerfile b/docker/Dockerfile index e200c9447..968584c1a 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -7,7 +7,7 @@ # docker run -d --name yacy -p 8090:8090 -p 8443:8443 -v yacy_data:/opt/yacy_search_server/DATA --log-opt max-size=200m --log-opt max-file=2 yacy/yacy_search_server:latest ## build base -FROM eclipse-temurin:17 AS base +FROM eclipse-temurin:21 AS base RUN apt-get update && apt-get install -yq wkhtmltopdf imagemagick xvfb ghostscript && rm -rf /var/lib/apt/lists/* ## build app @@ -35,7 +35,6 @@ RUN sed -i "/adminAccountBase64MD5=/c\adminAccountBase64MD5=MD5:8cffbc0d66567a09 sed -i "/server.https=false/c\server.https=true" /opt/yacy_search_server/defaults/yacy.init - ## build dist FROM base LABEL maintainer="Michael Peter Christen " diff --git a/docker/Dockerfile.alpine b/docker/Dockerfile.alpine index d3618a3a1..9e83f2685 100644 --- a/docker/Dockerfile.alpine +++ b/docker/Dockerfile.alpine @@ -1,6 +1,5 @@ # Build a docker image from latest YaCy sources on Alpine Linux - -# Base image : latest stable official jdk 11 image from Docker based on Alpine Linux +# with wkhtmltopdf for PDF generation and Java 21 FROM surnet/alpine-wkhtmltopdf:3.21.2-0.12.6-full as wkhtmltopdf FROM eclipse-temurin:21-alpine-3.21 @@ -9,27 +8,27 @@ RUN java -version # Install dependencies for wkhtmltopdf RUN apk add --no-cache \ - libstdc++ \ - libx11 \ - libxrender \ - libxext \ - libssl3 \ - ca-certificates \ - fontconfig \ - freetype \ - ttf-dejavu \ - ttf-droid \ - ttf-freefont \ - ttf-liberation \ - # more fonts - && apk add --no-cache --virtual .build-deps \ - msttcorefonts-installer \ - # Install microsoft fonts - && update-ms-fonts \ - && fc-cache -f \ - # Clean up when done - && rm -rf /tmp/* \ - && apk del .build-deps + libstdc++ \ + libx11 \ + libxrender \ + libxext \ + libssl3 \ + ca-certificates \ + fontconfig \ + freetype \ + ttf-dejavu \ + ttf-droid \ + ttf-freefont \ + ttf-liberation \ + # more fonts + && apk add --no-cache --virtual .build-deps \ + msttcorefonts-installer \ + # Install microsoft fonts + && update-ms-fonts \ + && fc-cache -f \ + # Clean up when done + && rm -rf /tmp/* \ + && apk del .build-deps # Copy wkhtmltopdf files from docker-wkhtmltopdf image COPY --from=wkhtmltopdf /bin/wkhtmltopdf /bin/wkhtmltopdf @@ -37,13 +36,10 @@ COPY --from=wkhtmltopdf /bin/wkhtmltoimage /bin/wkhtmltoimage COPY --from=wkhtmltopdf /lib/libwkhtmltox* /lib/ # Install needed packages not in base image -# (curl for sh scripts in /bin, imagemagick, xvfb, ghostscript, wkhtmltopdf, and apache-ant for building) RUN apk add --no-cache curl git imagemagick xvfb ghostscript apache-ant -# set current working dir +# set current working dir & copy sources WORKDIR /opt - -# copy sources COPY . /opt/yacy_search_server/ RUN ant compile -f /opt/yacy_search_server/build.xml && \ @@ -51,14 +47,14 @@ RUN ant compile -f /opt/yacy_search_server/build.xml && \ rm -rf /opt/ant RUN \ -# Set initial admin password: "yacy" (encoded with custom yacy md5 function net.yacy.cora.order.Digest.encodeMD5Hex()) + # Set initial admin password: "yacy" (encoded with custom yacy md5 function net.yacy.cora.order.Digest.encodeMD5Hex()) sed -i "/adminAccountBase64MD5=/c\adminAccountBase64MD5=MD5:8cffbc0d66567a0987a4aba1ec46d63c" /opt/yacy_search_server/defaults/yacy.init && \ sed -i "/adminAccountForLocalhost=/c\adminAccountForLocalhost=false" /opt/yacy_search_server/defaults/yacy.init && \ -# Intially enable HTTPS: this is the most secure option for remote administrator authentication + # Intially enable HTTPS: this is the most secure option for remote administrator authentication 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 + # Create user and group yacy: this user will be used to run YaCy main process addgroup yacy && adduser -S -G yacy -H -D yacy && \ -# Set ownership of yacy install directory to yacy user/group + # Set ownership of yacy install directory to yacy user/group chown yacy:yacy -R /opt/yacy_search_server RUN rm -rf /opt/yacy_search_server/DATA -- cgit v1.2.3 From d2b863a3a4c2377812aff7aa7edf845bc0291cfc Mon Sep 17 00:00:00 2001 From: Mister_X Date: Sun, 6 Apr 2025 01:56:09 +0200 Subject: test dockerfile --- .dockerignore | 3 ++- .github/workflows/build-docker-image.yaml | 6 ++--- docker/Dockerfile | 38 ++++++++++++++----------------- 3 files changed, 22 insertions(+), 25 deletions(-) (limited to 'docker') diff --git a/.dockerignore b/.dockerignore index 0f41b6fc7..484cdc123 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,3 +1,5 @@ +.git +.github DATA* RELEASE yacy.log @@ -8,4 +10,3 @@ examples build.nsi README.md Heroku.md - diff --git a/.github/workflows/build-docker-image.yaml b/.github/workflows/build-docker-image.yaml index 6016fca59..ee103b023 100644 --- a/.github/workflows/build-docker-image.yaml +++ b/.github/workflows/build-docker-image.yaml @@ -22,9 +22,9 @@ jobs: matrix: include: - tag: "" # Default Dockerfile - platforms: linux/amd64,linux/arm64 - - tag: alpine - platforms: linux/amd64,linux/arm64 + platforms: linux/amd64,linux/arm64,linux/arm,linux/riscv64 + # - tag: alpine + # platforms: linux/amd64,linux/arm64 runs-on: ubuntu-latest steps: diff --git a/docker/Dockerfile b/docker/Dockerfile index 968584c1a..ec886b8c3 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -6,42 +6,38 @@ # run with # docker run -d --name yacy -p 8090:8090 -p 8443:8443 -v yacy_data:/opt/yacy_search_server/DATA --log-opt max-size=200m --log-opt max-file=2 yacy/yacy_search_server:latest -## build base -FROM eclipse-temurin:21 AS base -RUN apt-get update && apt-get install -yq wkhtmltopdf imagemagick xvfb ghostscript && rm -rf /var/lib/apt/lists/* - -## build app -FROM base AS appbuilder - -RUN apt-get update && apt-get install -yq ant git curl && rm -rf /var/lib/apt/lists/* -RUN java -version +## build +FROM eclipse-temurin:21 AS builder +RUN apt-get update && apt-get install -y --no-install-recommends \ + ant \ + git \ + curl \ + && rm -rf /var/lib/apt/lists/* WORKDIR /opt COPY . /opt/yacy_search_server/ -RUN ant compile -f /opt/yacy_search_server/build.xml && \ - apt-get purge -yq --auto-remove ant && \ - apt-get clean && \ - rm -rf /var/lib/apt/lists/* - -WORKDIR /opt/yacy_search_server/ -#RUN git rev-parse HEAD > .git/shallow && \ -# git tag -l | xargs git tag -d && \ -# git gc --prune=now +RUN ant compile -f /opt/yacy_search_server/build.xml # Set initial admin password: "yacy" (encoded with custom yacy md5 function net.yacy.cora.order.Digest.encodeMD5Hex()) RUN sed -i "/adminAccountBase64MD5=/c\adminAccountBase64MD5=MD5:8cffbc0d66567a0987a4aba1ec46d63c" /opt/yacy_search_server/defaults/yacy.init && \ sed -i "/adminAccountForLocalhost=/c\adminAccountForLocalhost=false" /opt/yacy_search_server/defaults/yacy.init && \ sed -i "/server.https=false/c\server.https=true" /opt/yacy_search_server/defaults/yacy.init +## build final image +FROM eclipse-temurin:21-jre AS app + +RUN apt-get update && apt-get install -y --no-install-recommends \ + wkhtmltopdf \ + xvfb \ + ghostscript \ + && rm -rf /var/lib/apt/lists/* -## build dist -FROM base LABEL maintainer="Michael Peter Christen " RUN adduser --system --group --no-create-home --disabled-password yacy WORKDIR /opt -COPY --chown=yacy:yacy --from=appbuilder /opt/yacy_search_server /opt/yacy_search_server +COPY --chown=yacy:yacy --from=builder /opt/yacy_search_server /opt/yacy_search_server EXPOSE 8090 8443 VOLUME ["/opt/yacy_search_server/DATA"] -- cgit v1.2.3 From e5f24bd6ccd0bd915652ac8ca354141ef80ce8d4 Mon Sep 17 00:00:00 2001 From: Mister_X Date: Sun, 6 Apr 2025 02:00:47 +0200 Subject: fix platforms --- .github/workflows/build-docker-image.yaml | 2 +- docker/Dockerfile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'docker') diff --git a/.github/workflows/build-docker-image.yaml b/.github/workflows/build-docker-image.yaml index ee103b023..30e79b1d4 100644 --- a/.github/workflows/build-docker-image.yaml +++ b/.github/workflows/build-docker-image.yaml @@ -22,7 +22,7 @@ jobs: matrix: include: - tag: "" # Default Dockerfile - platforms: linux/amd64,linux/arm64,linux/arm,linux/riscv64 + platforms: linux/amd64,linux/arm64 # - tag: alpine # platforms: linux/amd64,linux/arm64 diff --git a/docker/Dockerfile b/docker/Dockerfile index ec886b8c3..ffb07f3fb 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -7,7 +7,7 @@ # docker run -d --name yacy -p 8090:8090 -p 8443:8443 -v yacy_data:/opt/yacy_search_server/DATA --log-opt max-size=200m --log-opt max-file=2 yacy/yacy_search_server:latest ## build -FROM eclipse-temurin:21 AS builder +FROM eclipse-temurin:21-jdk AS builder RUN apt-get update && apt-get install -y --no-install-recommends \ ant \ git \ -- cgit v1.2.3 From 632536c6f576ef6fb79c74046e3d0189cc83125e Mon Sep 17 00:00:00 2001 From: Mister_X Date: Sun, 6 Apr 2025 02:56:14 +0200 Subject: fix alpine image --- .github/workflows/ant-build-release.yaml | 5 ++- .github/workflows/build-docker-image.yaml | 4 +-- docker/Dockerfile | 3 +- docker/Dockerfile.alpine | 56 ++++++++++++++++--------------- 4 files changed, 35 insertions(+), 33 deletions(-) (limited to 'docker') diff --git a/.github/workflows/ant-build-release.yaml b/.github/workflows/ant-build-release.yaml index 8d0d8c7f9..de61e6f80 100644 --- a/.github/workflows/ant-build-release.yaml +++ b/.github/workflows/ant-build-release.yaml @@ -2,8 +2,6 @@ name: Build Executable on: push: - branches: # ONLY FOR TESTING - - "**" tags: - "v*.*.*" - "Release_*" @@ -18,7 +16,8 @@ jobs: build: strategy: matrix: - os: [macos-latest, ubuntu-latest, windows-latest] + #os: [macos-latest, ubuntu-latest, windows-latest] + os: [ubuntu-latest] runs-on: ${{ matrix.os }} diff --git a/.github/workflows/build-docker-image.yaml b/.github/workflows/build-docker-image.yaml index 30e79b1d4..6016fca59 100644 --- a/.github/workflows/build-docker-image.yaml +++ b/.github/workflows/build-docker-image.yaml @@ -23,8 +23,8 @@ jobs: include: - tag: "" # Default Dockerfile platforms: linux/amd64,linux/arm64 - # - tag: alpine - # platforms: linux/amd64,linux/arm64 + - tag: alpine + platforms: linux/amd64,linux/arm64 runs-on: ubuntu-latest steps: diff --git a/docker/Dockerfile b/docker/Dockerfile index ffb07f3fb..ca201b1f7 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -6,7 +6,7 @@ # run with # docker run -d --name yacy -p 8090:8090 -p 8443:8443 -v yacy_data:/opt/yacy_search_server/DATA --log-opt max-size=200m --log-opt max-file=2 yacy/yacy_search_server:latest -## build +## builder image FROM eclipse-temurin:21-jdk AS builder RUN apt-get update && apt-get install -y --no-install-recommends \ ant \ @@ -20,6 +20,7 @@ COPY . /opt/yacy_search_server/ RUN ant compile -f /opt/yacy_search_server/build.xml # Set initial admin password: "yacy" (encoded with custom yacy md5 function net.yacy.cora.order.Digest.encodeMD5Hex()) +# Intially enable HTTPS: this is the most secure option for remote administrator authentication RUN sed -i "/adminAccountBase64MD5=/c\adminAccountBase64MD5=MD5:8cffbc0d66567a0987a4aba1ec46d63c" /opt/yacy_search_server/defaults/yacy.init && \ sed -i "/adminAccountForLocalhost=/c\adminAccountForLocalhost=false" /opt/yacy_search_server/defaults/yacy.init && \ sed -i "/server.https=false/c\server.https=true" /opt/yacy_search_server/defaults/yacy.init diff --git a/docker/Dockerfile.alpine b/docker/Dockerfile.alpine index 9e83f2685..de8011195 100644 --- a/docker/Dockerfile.alpine +++ b/docker/Dockerfile.alpine @@ -1,13 +1,35 @@ # Build a docker image from latest YaCy sources on Alpine Linux # with wkhtmltopdf for PDF generation and Java 21 -FROM surnet/alpine-wkhtmltopdf:3.21.2-0.12.6-full as wkhtmltopdf -FROM eclipse-temurin:21-alpine-3.21 -# trace java version -RUN java -version +## builder image +FROM eclipse-temurin:21-jdk-alpine-3.21 AS builder + +# Install needed packages not in base image +RUN apk add --no-cache curl git apache-ant + +# set current working dir & copy sources +WORKDIR /opt +COPY . /opt/yacy_search_server/ + +RUN ant compile -f /opt/yacy_search_server/build.xml + +# Set initial admin password: "yacy" (encoded with custom yacy md5 function net.yacy.cora.order.Digest.encodeMD5Hex()) +# Intially enable HTTPS: this is the most secure option for remote administrator authentication +# Create user and group yacy: this user will be used to run YaCy main process +# Set ownership of yacy install directory to yacy user/group +RUN sed -i "/adminAccountBase64MD5=/c\adminAccountBase64MD5=MD5:8cffbc0d66567a0987a4aba1ec46d63c" /opt/yacy_search_server/defaults/yacy.init && \ + sed -i "/adminAccountForLocalhost=/c\adminAccountForLocalhost=false" /opt/yacy_search_server/defaults/yacy.init && \ + sed -i "/server.https=false/c\server.https=true" /opt/yacy_search_server/defaults/yacy.init + +## build final image +FROM surnet/alpine-wkhtmltopdf:3.21.2-0.12.6-full AS wkhtmltopdf +FROM eclipse-temurin:21-jre-alpine-3.21 AS app -# Install dependencies for wkhtmltopdf RUN apk add --no-cache \ + imagemagick \ + xvfb \ + ghostscript \ + # Install dependencies for wkhtmltopdf libstdc++ \ libx11 \ libxrender \ @@ -35,29 +57,9 @@ COPY --from=wkhtmltopdf /bin/wkhtmltopdf /bin/wkhtmltopdf COPY --from=wkhtmltopdf /bin/wkhtmltoimage /bin/wkhtmltoimage COPY --from=wkhtmltopdf /lib/libwkhtmltox* /lib/ -# Install needed packages not in base image -RUN apk add --no-cache curl git imagemagick xvfb ghostscript apache-ant - -# set current working dir & copy sources +RUN addgroup yacy && adduser -S -G yacy -H -D yacy WORKDIR /opt -COPY . /opt/yacy_search_server/ - -RUN ant compile -f /opt/yacy_search_server/build.xml && \ - rm -rf /opt/yacy_search_server/.git && \ - rm -rf /opt/ant - -RUN \ - # Set initial admin password: "yacy" (encoded with custom yacy md5 function net.yacy.cora.order.Digest.encodeMD5Hex()) - sed -i "/adminAccountBase64MD5=/c\adminAccountBase64MD5=MD5:8cffbc0d66567a0987a4aba1ec46d63c" /opt/yacy_search_server/defaults/yacy.init && \ - sed -i "/adminAccountForLocalhost=/c\adminAccountForLocalhost=false" /opt/yacy_search_server/defaults/yacy.init && \ - # Intially enable HTTPS: this is the most secure option for remote administrator authentication - 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 - addgroup yacy && adduser -S -G yacy -H -D yacy && \ - # Set ownership of yacy install directory to yacy user/group - chown yacy:yacy -R /opt/yacy_search_server - -RUN rm -rf /opt/yacy_search_server/DATA +COPY --chown=yacy:yacy --from=builder /opt/yacy_search_server /opt/yacy_search_server # Expose HTTP and HTTPS default ports EXPOSE 8090 8443 -- cgit v1.2.3 From a4f4569f3656c1ef3340a1f616ef5c3e5d42faa6 Mon Sep 17 00:00:00 2001 From: Mister_X Date: Sun, 6 Apr 2025 03:18:14 +0200 Subject: decrease alpine image size --- docker/Dockerfile.alpine | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'docker') diff --git a/docker/Dockerfile.alpine b/docker/Dockerfile.alpine index de8011195..6db74f4df 100644 --- a/docker/Dockerfile.alpine +++ b/docker/Dockerfile.alpine @@ -22,7 +22,7 @@ RUN sed -i "/adminAccountBase64MD5=/c\adminAccountBase64MD5=MD5:8cffbc0d66567a09 sed -i "/server.https=false/c\server.https=true" /opt/yacy_search_server/defaults/yacy.init ## build final image -FROM surnet/alpine-wkhtmltopdf:3.21.2-0.12.6-full AS wkhtmltopdf +FROM surnet/alpine-wkhtmltopdf:3.21.2-0.12.6-small AS wkhtmltopdf FROM eclipse-temurin:21-jre-alpine-3.21 AS app RUN apk add --no-cache \ @@ -53,9 +53,7 @@ RUN apk add --no-cache \ && apk del .build-deps # Copy wkhtmltopdf files from docker-wkhtmltopdf image -COPY --from=wkhtmltopdf /bin/wkhtmltopdf /bin/wkhtmltopdf -COPY --from=wkhtmltopdf /bin/wkhtmltoimage /bin/wkhtmltoimage -COPY --from=wkhtmltopdf /lib/libwkhtmltox* /lib/ +COPY --from=builder /bin/wkhtmltopdf /bin/wkhtmltopdf RUN addgroup yacy && adduser -S -G yacy -H -D yacy WORKDIR /opt -- cgit v1.2.3 From a3c0781cf070570308b1c43adcf167d34f88ab28 Mon Sep 17 00:00:00 2001 From: Mister_X Date: Sun, 6 Apr 2025 03:21:08 +0200 Subject: fix typo --- docker/Dockerfile.alpine | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'docker') diff --git a/docker/Dockerfile.alpine b/docker/Dockerfile.alpine index 6db74f4df..3d1ff1a80 100644 --- a/docker/Dockerfile.alpine +++ b/docker/Dockerfile.alpine @@ -53,7 +53,7 @@ RUN apk add --no-cache \ && apk del .build-deps # Copy wkhtmltopdf files from docker-wkhtmltopdf image -COPY --from=builder /bin/wkhtmltopdf /bin/wkhtmltopdf +COPY --from=wkhtmltopdf /bin/wkhtmltopdf /bin/wkhtmltopdf RUN addgroup yacy && adduser -S -G yacy -H -D yacy WORKDIR /opt -- cgit v1.2.3 From 24a244baf6891876c136100e0af399f2a2333b8d Mon Sep 17 00:00:00 2001 From: Mister_X Date: Sun, 6 Apr 2025 14:06:53 +0200 Subject: add documentation for tags --- docker/DockerImageTags.md | 57 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 docker/DockerImageTags.md (limited to 'docker') diff --git a/docker/DockerImageTags.md b/docker/DockerImageTags.md new file mode 100644 index 000000000..cf8b8d9e7 --- /dev/null +++ b/docker/DockerImageTags.md @@ -0,0 +1,57 @@ +# Docker Image Tags Documentation + +This document describes the tags generated by the `docker/metadata-action` in the GitHub Actions workflow for building Docker images. + +## Base Name + +The base name for the Docker images is derived from the repository: + +- `ghcr.io/yacy/yacy_search_server` (GitHub Container Registry) +- `yacy/yacy_search_server` (Docker Hub) + +## Version Structure + +The tags are generated based on the following rules: + +### Default Tags + +- `latest`: Automatically assigned to the latest tagged release. + +### Semantic Versioning Tags + +For releases following semantic versioning (e.g., `1.2.3` or the `Release_1.2` format), the following tags are created: + +- `1.2.3`: Full version tag. +- `1.2`: Major and minor version tag. +- `1`: Major version tag. + +### Branch Tags + +- ``: For latest commit of branches (bleeding edge channel, e.g. `master`). + +### Pull Request Tags + +- `pr-`: For latest commit of pull requests. + +## Image Variants + +The Docker images come in many flavors, each designed for a specific use case. + +### `yacy/yacy_search_server:` + +This is the default image. If you are unsure about what your needs are, you probably want to use this one. + +### `yacy/yacy_search_server:-alpine` + +This image is based on the popular Alpine Linux project. Alpine Linux is much smaller than most distribution base images (~5MB), and thus leads to much slimmer images in general. + +## Examples + +- `ghcr.io/yacy/yacy_search_server:latest` +- `ghcr.io/yacy/yacy_search_server:1.2.3` +- `ghcr.io/yacy/yacy_search_server:1.2` +- `ghcr.io/yacy/yacy_search_server:1` +- `ghcr.io/yacy/yacy_search_server:master` +- `ghcr.io/yacy/yacy_search_server:pr-42` +- `ghcr.io/yacy/yacy_search_server:latest-alpine` +- `ghcr.io/yacy/yacy_search_server:1.2.3-alpine` -- cgit v1.2.3 From d51d0169b4d9855e1cb0e99892bc7c2819caa619 Mon Sep 17 00:00:00 2001 From: Mister_X Date: Sun, 6 Apr 2025 14:59:43 +0200 Subject: update docker readme --- .github/workflows/ant-build-release.yaml | 3 +- docker/Readme.md | 176 +++++++++++++++++++++---------- 2 files changed, 122 insertions(+), 57 deletions(-) (limited to 'docker') diff --git a/.github/workflows/ant-build-release.yaml b/.github/workflows/ant-build-release.yaml index de61e6f80..2912d95ef 100644 --- a/.github/workflows/ant-build-release.yaml +++ b/.github/workflows/ant-build-release.yaml @@ -1,4 +1,5 @@ -name: Build Executable +name: Build GitHub Release +# This workflow builds the YaCy Search Server and creates a GitHub Release with the build artifacts. on: push: diff --git a/docker/Readme.md b/docker/Readme.md index b40a2a73a..8a63637b3 100644 --- a/docker/Readme.md +++ b/docker/Readme.md @@ -1,150 +1,214 @@ # Yacy Docker image from latest sources -## Supported tags and respective Dockerfiles +## Supported tags -* latest (Dockerfile) -* latest-alpine (Dockerfile.alpine) +* `latest` (Latest stable release) +* `latest-alpine` (Latest stable release based on Alpine Linux) +* `` (Lock on a specific/minor/major version, e.g., `1.2.3`, `1.2`, `1`) +* `-alpine` (e.g., `1.2.3-alpine`) +* `` (e.g., `master` for the latest commit of branches) +* `pr-` (e.g., `pr-42` for pull requests) -## Getting built image from Docker Hub +For a detailed explanation of supported tags, refer to [DockerImageTags.md](./DockerImageTags.md). -The repository URL is https://hub.docker.com/r/yacy/yacy_search_server/ +## Getting built image from Docker Hub and GitHub Container Registry -* ubuntu-based: `docker pull yacy/yacy_search_server:latest` +The repository URLs are: +* Docker Hub: +* GitHub Container Registry: `ghcr.io/yacy/yacy_search_server` + +Examples: + +* `docker pull yacy/yacy_search_server:latest` +* `docker pull ghcr.io/yacy/yacy_search_server:latest` +* `docker pull ghcr.io/yacy/yacy_search_server:latest-alpine` +* `docker pull ghcr.io/yacy/yacy_search_server:1.2.3` +* `docker pull ghcr.io/yacy/yacy_search_server:master` +* `docker pull ghcr.io/yacy/yacy_search_server:pr-42` ## Building image yourself Using files in 'yacy_search_server/docker/': -``` + +```sh cd yacy_search_server/docker ``` Then according to the image type: -* `yacy/yacy_search_server:latest`: This image is based on latest stable official Debian stable [openjdk](https://hub.docker.com/_/openjdk/) 11 image provided by Docker. Embed Yacy compiled from latest git repository sources. -``` +* `yacy/yacy_search_server:latest`: This image is based on the latest stable official [Eclipse Temurin](https://hub.docker.com/_/eclipse-temurin) 21 release. It includes YaCy compiled from the latest git repository sources. +* `yacy/yacy_search_server:latest-alpine`: This image is based on the latest stable [Eclipse Temurin](https://hub.docker.com/_/eclipse-temurin) 21 release with Alpine Linux as the base. It also includes YaCy compiled from the latest git repository sources. + +```sh docker build -t yacy/yacy_search_server:latest -f Dockerfile ../ ``` -* `yacy/yacy_search_server:aarch64-latest`: same as yacy/yacy_search_server:latest but based on - -``` -docker build -t yacy/yacy_search_server:aarch64-latest -f Dockerfile.aarch64 ../ -``` +## Usage +### Run the Docker image directly +You can run the YaCy Docker image directly using the following command: -## Usage +```sh +docker run -d --name yacy -p 8090:8090 -p 8443:8443 -v yacy_data:/opt/yacy_search_server/DATA --log-opt max-size=200m --log-opt max-file=2 yacy/yacy_search_server:latest +``` -### Run the docker image +### Using Docker Compose + +You can also use Docker Compose to run the YaCy container. Create a `docker-compose.yml` file with the following content: + +```yaml +services: + yacy: + container_name: yacy + image: yacy/yacy_search_server:latest + restart: unless-stopped + ports: + - "8090:8090" + - "8443:8443" + volumes: + - yacy_data:/opt/yacy_search_server/DATA + logging: + options: + max-size: "200m" + max-file: "2" + +volumes: + yacy_data: +``` +Then start the container with: -``` -docker run -d --name yacy -p 8090:8090 -p 8443:8443 -v yacy_data:/opt/yacy_search_server/DATA --log-opt max-size=200m --log-opt max-file=2 yacy/yacy_search_server:latest +```sh +docker-compose up -d ``` -YaCy web interface is then exposed at http://[container_ip]:8090 +YaCy web interface is then exposed at `http://[container_ip]:8090` You can retrieve the container IP address with `docker inspect`. -#### Default admin account +### Default admin account * login: admin * password: yacy You should modify this default password with page /ConfigAccounts_p.html when exposing publicly your YaCy container. +### Handle persistent data volume -#### Handle persistent data volume +As configured in the Dockerfile, by default YaCy data (in /opt/yacy_search_server/DATA) will persist after container stop or deletion, in a volume named "yacy_data". -As configured in the Dockerfile, by default yacy data (in /opt/yacy_search_server/DATA) will persist after container stop or deletion, in a volume named "yacy_data" - - ### HTTPS support This images are default configured with HTTPS enabled, and use a default certificate stored in defaults/freeworldKeystore. You should use your own certificate. In order to do it, you can proceed as follow. #### Self-signed certificate -A self-signed certificate will provide encrypted communications with your YaCy server, but browsers will still complain about an invalid security certificate with the error "SEC_ERROR_UNKNOWN_ISSUER". If it is sufficient for you, you can permanently add and exception to your browser. +A self-signed certificate will provide encrypted communications with your YaCy server, but browsers will still complain about an invalid security certificate with the error "SEC_ERROR_UNKNOWN_ISSUER". If it is sufficient for you, you can permanently add an exception to your browser. This kind of certificate can be generated and added to your YaCy Docker container with the following: - keytool -keystore /var/lib/docker/volumes/[your_yacy_volume]/_data/SETTINGS/yacykeystore -genkey -keyalg RSA -alias yacycert - -Then edit YaCy config file. For example with the nano text editor: +```sh +keytool -keystore /var/lib/docker/volumes/[your_yacy_volume]/_data/SETTINGS/yacykeystore -genkey -keyalg RSA -alias yacycert +``` + +Then edit YaCy config file. For example, with the nano text editor: - nano /var/lib/docker/volumes/[your_yacy_volume]/_data/SETTINGS/yacy.conf +```sh +nano /var/lib/docker/volumes/[your_yacy_volume]/_data/SETTINGS/yacy.conf +``` And configure the keyStoreXXXX properties accordingly: - keyStore=/opt/yacy_search_server/DATA/SETTINGS/yacykeystore - keyStorePassword=yourpassword - -#### Import an existing certificate: +```sh +keyStore=/opt/yacy_search_server/DATA/SETTINGS/yacykeystore +keyStorePassword=yourpassword +``` + +#### Import an existing certificate Importing a certificate validated by a certification authority (CA) will ensure you have full HTTPS support with no security errors when accessing your YaCy peer. You can import an existing certificate in pkcs12 format. First copy it to the YaCy Docker container volume: - cp [yourStore].pkcs12 /var/lib/docker/volumes/[your_yacy_volume]/_data/SETTINGS/[yourStore].pkcs12 +```sh +cp [yourStore].pkcs12 /var/lib/docker/volumes/[your_yacy_volume]/_data/SETTINGS/[yourStore].pkcs12 +``` -Then edit YaCy config file. For example with the nano text editor: +Then edit YaCy config file. For example, with the nano text editor: - nano /var/lib/docker/volumes/[your_yacy_volume]/_data/SETTINGS/yacy.conf +```sh +nano /var/lib/docker/volumes/[your_yacy_volume]/_data/SETTINGS/yacy.conf +``` And configure the pkcs12XXX properties accordingly: - pkcs12ImportFile=/opt/yacy_search_server/DATA/SETTINGS/[yourStore].pkcs12 - pkcs12ImportPwd=yourpassword +```sh +pkcs12ImportFile=/opt/yacy_search_server/DATA/SETTINGS/[yourStore].pkcs12 +pkcs12ImportPwd=yourpassword +``` ### Next starts #### As attached process - docker start -a yacy +```sh +docker start -a yacy +``` #### As background process - docker start yacy +```sh +docker start yacy +``` ### Shutdown * Use "Shutdown" button in administration web interface * OR run: - docker exec [your_container_name] /opt/yacy_search_server/stopYACY.sh +```sh +docker exec yacy /opt/yacy_search_server/stopYACY.sh +``` * OR run: - docker stop [your_container_name] +```sh +docker stop yacy +``` ### Upgrade -You can upgrade your YaCy container the Docker way with the following commands sequence. +To upgrade your YaCy container, follow these steps: -Get latest Docker image: +1. Pull the latest Docker image: + ```sh docker pull yacy/yacy_search_server:latest + ``` -Create new container based on pulled image, using volume data from old container: - - docker create --name [tmp-container_name] -p 8090:8090 -p 8443:8443 --volumes-from=[container_name] --log-opt max-size=100m --log-opt max-file=2 yacy/yacy_search_server:latest +2. Stop and remove the old container: -Stop old container: + ```sh + docker stop yacy + docker rm yacy + ``` - docker exec [container_name] /opt/yacy_search_server/stopYACY.sh +3. Run the new container using the same command as before: -Start new container: + ```sh + docker run -d --name yacy -p 8090:8090 -p 8443:8443 -v yacy_data:/opt/yacy_search_server/DATA --log-opt max-size=200m --log-opt max-file=2 yacy/yacy_search_server:latest + ``` - docker start [tmp-container_name] +#### Update Docker Compose Images -Check everything works fine, then you can delete old container: +To update the images created with the Docker Compose file, you can use the following command: - docker rm [container_name] - -Rename new container to reuse same container name: +```sh +docker-compose up -d --force-recreate --pull always +``` - docker rename [tmp-container_name] [container_name] +This command ensures that the latest images are pulled and the containers are recreated with the updated images. ## License -- cgit v1.2.3 From 3b2324f1ae41585f23038d14537fe6a0cb8cde40 Mon Sep 17 00:00:00 2001 From: Mister_X Date: Sun, 6 Apr 2025 15:01:51 +0200 Subject: capitalize docker readme filename --- docker/README.md | 215 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ docker/Readme.md | 215 ------------------------------------------------------- 2 files changed, 215 insertions(+), 215 deletions(-) create mode 100644 docker/README.md delete mode 100644 docker/Readme.md (limited to 'docker') diff --git a/docker/README.md b/docker/README.md new file mode 100644 index 000000000..8a63637b3 --- /dev/null +++ b/docker/README.md @@ -0,0 +1,215 @@ +# Yacy Docker image from latest sources + +## Supported tags + +* `latest` (Latest stable release) +* `latest-alpine` (Latest stable release based on Alpine Linux) +* `` (Lock on a specific/minor/major version, e.g., `1.2.3`, `1.2`, `1`) +* `-alpine` (e.g., `1.2.3-alpine`) +* `` (e.g., `master` for the latest commit of branches) +* `pr-` (e.g., `pr-42` for pull requests) + +For a detailed explanation of supported tags, refer to [DockerImageTags.md](./DockerImageTags.md). + +## Getting built image from Docker Hub and GitHub Container Registry + +The repository URLs are: + +* Docker Hub: +* GitHub Container Registry: `ghcr.io/yacy/yacy_search_server` + +Examples: + +* `docker pull yacy/yacy_search_server:latest` +* `docker pull ghcr.io/yacy/yacy_search_server:latest` +* `docker pull ghcr.io/yacy/yacy_search_server:latest-alpine` +* `docker pull ghcr.io/yacy/yacy_search_server:1.2.3` +* `docker pull ghcr.io/yacy/yacy_search_server:master` +* `docker pull ghcr.io/yacy/yacy_search_server:pr-42` + +## Building image yourself + +Using files in 'yacy_search_server/docker/': + +```sh +cd yacy_search_server/docker +``` + +Then according to the image type: + +* `yacy/yacy_search_server:latest`: This image is based on the latest stable official [Eclipse Temurin](https://hub.docker.com/_/eclipse-temurin) 21 release. It includes YaCy compiled from the latest git repository sources. +* `yacy/yacy_search_server:latest-alpine`: This image is based on the latest stable [Eclipse Temurin](https://hub.docker.com/_/eclipse-temurin) 21 release with Alpine Linux as the base. It also includes YaCy compiled from the latest git repository sources. + +```sh +docker build -t yacy/yacy_search_server:latest -f Dockerfile ../ +``` + +## Usage + +### Run the Docker image directly + +You can run the YaCy Docker image directly using the following command: + +```sh +docker run -d --name yacy -p 8090:8090 -p 8443:8443 -v yacy_data:/opt/yacy_search_server/DATA --log-opt max-size=200m --log-opt max-file=2 yacy/yacy_search_server:latest +``` + +### Using Docker Compose + +You can also use Docker Compose to run the YaCy container. Create a `docker-compose.yml` file with the following content: + +```yaml +services: + yacy: + container_name: yacy + image: yacy/yacy_search_server:latest + restart: unless-stopped + ports: + - "8090:8090" + - "8443:8443" + volumes: + - yacy_data:/opt/yacy_search_server/DATA + logging: + options: + max-size: "200m" + max-file: "2" + +volumes: + yacy_data: +``` + +Then start the container with: + +```sh +docker-compose up -d +``` + +YaCy web interface is then exposed at `http://[container_ip]:8090` +You can retrieve the container IP address with `docker inspect`. + +### Default admin account + +* login: admin +* password: yacy + +You should modify this default password with page /ConfigAccounts_p.html when exposing publicly your YaCy container. + +### Handle persistent data volume + +As configured in the Dockerfile, by default YaCy data (in /opt/yacy_search_server/DATA) will persist after container stop or deletion, in a volume named "yacy_data". + +### HTTPS support + +This images are default configured with HTTPS enabled, and use a default certificate stored in defaults/freeworldKeystore. You should use your own certificate. In order to do it, you can proceed as follow. + +#### Self-signed certificate + +A self-signed certificate will provide encrypted communications with your YaCy server, but browsers will still complain about an invalid security certificate with the error "SEC_ERROR_UNKNOWN_ISSUER". If it is sufficient for you, you can permanently add an exception to your browser. + +This kind of certificate can be generated and added to your YaCy Docker container with the following: + +```sh +keytool -keystore /var/lib/docker/volumes/[your_yacy_volume]/_data/SETTINGS/yacykeystore -genkey -keyalg RSA -alias yacycert +``` + +Then edit YaCy config file. For example, with the nano text editor: + +```sh +nano /var/lib/docker/volumes/[your_yacy_volume]/_data/SETTINGS/yacy.conf +``` + +And configure the keyStoreXXXX properties accordingly: + +```sh +keyStore=/opt/yacy_search_server/DATA/SETTINGS/yacykeystore +keyStorePassword=yourpassword +``` + +#### Import an existing certificate + +Importing a certificate validated by a certification authority (CA) will ensure you have full HTTPS support with no security errors when accessing your YaCy peer. You can import an existing certificate in pkcs12 format. + +First copy it to the YaCy Docker container volume: + +```sh +cp [yourStore].pkcs12 /var/lib/docker/volumes/[your_yacy_volume]/_data/SETTINGS/[yourStore].pkcs12 +``` + +Then edit YaCy config file. For example, with the nano text editor: + +```sh +nano /var/lib/docker/volumes/[your_yacy_volume]/_data/SETTINGS/yacy.conf +``` + +And configure the pkcs12XXX properties accordingly: + +```sh +pkcs12ImportFile=/opt/yacy_search_server/DATA/SETTINGS/[yourStore].pkcs12 +pkcs12ImportPwd=yourpassword +``` + +### Next starts + +#### As attached process + +```sh +docker start -a yacy +``` + +#### As background process + +```sh +docker start yacy +``` + +### Shutdown + +* Use "Shutdown" button in administration web interface +* OR run: + +```sh +docker exec yacy /opt/yacy_search_server/stopYACY.sh +``` + +* OR run: + +```sh +docker stop yacy +``` + +### Upgrade + +To upgrade your YaCy container, follow these steps: + +1. Pull the latest Docker image: + + ```sh + docker pull yacy/yacy_search_server:latest + ``` + +2. Stop and remove the old container: + + ```sh + docker stop yacy + docker rm yacy + ``` + +3. Run the new container using the same command as before: + + ```sh + docker run -d --name yacy -p 8090:8090 -p 8443:8443 -v yacy_data:/opt/yacy_search_server/DATA --log-opt max-size=200m --log-opt max-file=2 yacy/yacy_search_server:latest + ``` + +#### Update Docker Compose Images + +To update the images created with the Docker Compose file, you can use the following command: + +```sh +docker-compose up -d --force-recreate --pull always +``` + +This command ensures that the latest images are pulled and the containers are recreated with the updated images. + +## License + +View [license](https://github.com/yacy/yacy_search_server/blob/master/COPYRIGHT) information for the software contained in this image. diff --git a/docker/Readme.md b/docker/Readme.md deleted file mode 100644 index 8a63637b3..000000000 --- a/docker/Readme.md +++ /dev/null @@ -1,215 +0,0 @@ -# Yacy Docker image from latest sources - -## Supported tags - -* `latest` (Latest stable release) -* `latest-alpine` (Latest stable release based on Alpine Linux) -* `` (Lock on a specific/minor/major version, e.g., `1.2.3`, `1.2`, `1`) -* `-alpine` (e.g., `1.2.3-alpine`) -* `` (e.g., `master` for the latest commit of branches) -* `pr-` (e.g., `pr-42` for pull requests) - -For a detailed explanation of supported tags, refer to [DockerImageTags.md](./DockerImageTags.md). - -## Getting built image from Docker Hub and GitHub Container Registry - -The repository URLs are: - -* Docker Hub: -* GitHub Container Registry: `ghcr.io/yacy/yacy_search_server` - -Examples: - -* `docker pull yacy/yacy_search_server:latest` -* `docker pull ghcr.io/yacy/yacy_search_server:latest` -* `docker pull ghcr.io/yacy/yacy_search_server:latest-alpine` -* `docker pull ghcr.io/yacy/yacy_search_server:1.2.3` -* `docker pull ghcr.io/yacy/yacy_search_server:master` -* `docker pull ghcr.io/yacy/yacy_search_server:pr-42` - -## Building image yourself - -Using files in 'yacy_search_server/docker/': - -```sh -cd yacy_search_server/docker -``` - -Then according to the image type: - -* `yacy/yacy_search_server:latest`: This image is based on the latest stable official [Eclipse Temurin](https://hub.docker.com/_/eclipse-temurin) 21 release. It includes YaCy compiled from the latest git repository sources. -* `yacy/yacy_search_server:latest-alpine`: This image is based on the latest stable [Eclipse Temurin](https://hub.docker.com/_/eclipse-temurin) 21 release with Alpine Linux as the base. It also includes YaCy compiled from the latest git repository sources. - -```sh -docker build -t yacy/yacy_search_server:latest -f Dockerfile ../ -``` - -## Usage - -### Run the Docker image directly - -You can run the YaCy Docker image directly using the following command: - -```sh -docker run -d --name yacy -p 8090:8090 -p 8443:8443 -v yacy_data:/opt/yacy_search_server/DATA --log-opt max-size=200m --log-opt max-file=2 yacy/yacy_search_server:latest -``` - -### Using Docker Compose - -You can also use Docker Compose to run the YaCy container. Create a `docker-compose.yml` file with the following content: - -```yaml -services: - yacy: - container_name: yacy - image: yacy/yacy_search_server:latest - restart: unless-stopped - ports: - - "8090:8090" - - "8443:8443" - volumes: - - yacy_data:/opt/yacy_search_server/DATA - logging: - options: - max-size: "200m" - max-file: "2" - -volumes: - yacy_data: -``` - -Then start the container with: - -```sh -docker-compose up -d -``` - -YaCy web interface is then exposed at `http://[container_ip]:8090` -You can retrieve the container IP address with `docker inspect`. - -### Default admin account - -* login: admin -* password: yacy - -You should modify this default password with page /ConfigAccounts_p.html when exposing publicly your YaCy container. - -### Handle persistent data volume - -As configured in the Dockerfile, by default YaCy data (in /opt/yacy_search_server/DATA) will persist after container stop or deletion, in a volume named "yacy_data". - -### HTTPS support - -This images are default configured with HTTPS enabled, and use a default certificate stored in defaults/freeworldKeystore. You should use your own certificate. In order to do it, you can proceed as follow. - -#### Self-signed certificate - -A self-signed certificate will provide encrypted communications with your YaCy server, but browsers will still complain about an invalid security certificate with the error "SEC_ERROR_UNKNOWN_ISSUER". If it is sufficient for you, you can permanently add an exception to your browser. - -This kind of certificate can be generated and added to your YaCy Docker container with the following: - -```sh -keytool -keystore /var/lib/docker/volumes/[your_yacy_volume]/_data/SETTINGS/yacykeystore -genkey -keyalg RSA -alias yacycert -``` - -Then edit YaCy config file. For example, with the nano text editor: - -```sh -nano /var/lib/docker/volumes/[your_yacy_volume]/_data/SETTINGS/yacy.conf -``` - -And configure the keyStoreXXXX properties accordingly: - -```sh -keyStore=/opt/yacy_search_server/DATA/SETTINGS/yacykeystore -keyStorePassword=yourpassword -``` - -#### Import an existing certificate - -Importing a certificate validated by a certification authority (CA) will ensure you have full HTTPS support with no security errors when accessing your YaCy peer. You can import an existing certificate in pkcs12 format. - -First copy it to the YaCy Docker container volume: - -```sh -cp [yourStore].pkcs12 /var/lib/docker/volumes/[your_yacy_volume]/_data/SETTINGS/[yourStore].pkcs12 -``` - -Then edit YaCy config file. For example, with the nano text editor: - -```sh -nano /var/lib/docker/volumes/[your_yacy_volume]/_data/SETTINGS/yacy.conf -``` - -And configure the pkcs12XXX properties accordingly: - -```sh -pkcs12ImportFile=/opt/yacy_search_server/DATA/SETTINGS/[yourStore].pkcs12 -pkcs12ImportPwd=yourpassword -``` - -### Next starts - -#### As attached process - -```sh -docker start -a yacy -``` - -#### As background process - -```sh -docker start yacy -``` - -### Shutdown - -* Use "Shutdown" button in administration web interface -* OR run: - -```sh -docker exec yacy /opt/yacy_search_server/stopYACY.sh -``` - -* OR run: - -```sh -docker stop yacy -``` - -### Upgrade - -To upgrade your YaCy container, follow these steps: - -1. Pull the latest Docker image: - - ```sh - docker pull yacy/yacy_search_server:latest - ``` - -2. Stop and remove the old container: - - ```sh - docker stop yacy - docker rm yacy - ``` - -3. Run the new container using the same command as before: - - ```sh - docker run -d --name yacy -p 8090:8090 -p 8443:8443 -v yacy_data:/opt/yacy_search_server/DATA --log-opt max-size=200m --log-opt max-file=2 yacy/yacy_search_server:latest - ``` - -#### Update Docker Compose Images - -To update the images created with the Docker Compose file, you can use the following command: - -```sh -docker-compose up -d --force-recreate --pull always -``` - -This command ensures that the latest images are pulled and the containers are recreated with the updated images. - -## License - -View [license](https://github.com/yacy/yacy_search_server/blob/master/COPYRIGHT) information for the software contained in this image. -- cgit v1.2.3