pull/698/merge
Mister X 2 weeks ago committed by GitHub
commit 1d5cb6b8d1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -1,3 +1,5 @@
.git
.github
DATA*
RELEASE
yacy.log
@ -8,4 +10,3 @@ examples
build.nsi
README.md
Heroku.md

@ -0,0 +1,50 @@
name: Build Executable
on:
push:
tags:
- "v*.*.*"
- "Release_*"
pull_request:
workflow_dispatch:
permissions:
contents: write
actions: write
jobs:
build:
strategy:
matrix:
#os: [macos-latest, ubuntu-latest, windows-latest]
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Check-out repository
uses: actions/checkout@v4
- name: Setup Java
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '21'
cache: 'maven'
- name: Build
run: ant clean all dist
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ runner.os }} ${{ runner.arch }} Build
path: RELEASE/*
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
draft: true
generate_release_notes: true
files: RELEASE/*

@ -0,0 +1,78 @@
name: Build Docker Image
on:
push:
branches:
- "**"
tags:
- "v*.*.*"
- "Release_*"
pull_request:
workflow_dispatch:
permissions:
contents: read
packages: write
actions: write
jobs:
docker:
strategy:
fail-fast: false
matrix:
include:
- tag: "" # Default Dockerfile
platforms: linux/amd64,linux/arm64
- tag: alpine
platforms: linux/amd64,linux/arm64
runs-on: ubuntu-latest
steps:
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
# list of Docker images to use as base name for tags
images: |
ghcr.io/MisterX2000/yacy_search_server
# generate Docker tags based on the following events/attributes
flavor: |
latest=auto
prefix=
suffix=${{ matrix.tag != '' && format('-{0}', matrix.tag) || '' }},onlatest=true
tags: |
type=schedule
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=sha
type=match,pattern=Release_(\d+\.\d+),group=1
type=match,pattern=Release_(\d+),group=1
- name: Login to GitHub Container Registry
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build and push
uses: docker/build-push-action@v6
with:
# Use "Dockerfile" if matrix.tag is empty, otherwise use "Dockerfile.{tag}"
file: docker/Dockerfile${{ matrix.tag != '' && format('.{0}', matrix.tag) || '' }}
platforms: ${{ matrix.platforms }}
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max

@ -6,43 +6,39 @@
# 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:11-jdk-jammy 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
## builder image
FROM eclipse-temurin:21-jdk 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())
# 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
## 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 <mc@yacy.net>"
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"]

@ -1,105 +1,63 @@
# Build a docker image from latest YaCy sources on Alpine Linux
# with wkhtmltopdf for PDF generation and Java 21
# Base image : latest stable official jdk 11 image from Docker based on Alpine Linux
FROM openjdk:11-alpine
# 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
# (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
RUN apk add --no-cache curl git apache-ant
# 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
# set current working dir
# set current working dir & copy sources
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 && \
rm -rf /opt/yacy_search_server/.git && \
rm -rf /opt/ant
RUN ant compile -f /opt/yacy_search_server/build.xml
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 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-small AS wkhtmltopdf
FROM eclipse-temurin:21-jre-alpine-3.21 AS app
RUN rm -rf /opt/yacy_search_server/DATA
RUN apk add --no-cache \
imagemagick \
xvfb \
ghostscript \
# Install dependencies for wkhtmltopdf
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
RUN addgroup yacy && adduser -S -G yacy -H -D yacy
WORKDIR /opt
COPY --chown=yacy:yacy --from=builder /opt/yacy_search_server /opt/yacy_search_server
# Expose HTTP and HTTPS default ports
EXPOSE 8090 8443

Loading…
Cancel
Save