Files
Michael Meier a5a1f44441 Docker: Fix YaCy version determination
The .dockerignore file was preventing the .git directory from being
copied into the context during container builds, which prevented ant
from determining the YaCy version by running a few git commands.

This fixes containerized YaCy peer's version showing up as:
yacy_v1.941_fatal: not a git repository (or any of the parent directories):
.gitfatal: not a git repository (or any of the parent directories):
.git_fatal: not a git repository (or any of the parent directories): .git
2026-06-04 22:18:23 +02:00

58 lines
2.2 KiB
Docker

# ARM64v8 Docker image for YaCy
# build with
# docker build -t yacy/yacy_search_server:aarch64 -f Dockerfile.aarch64 ../
# 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:aarch64
## builder image
FROM arm64v8/openjdk:23-jdk-slim-bookworm AS builder
RUN for i in 1 2 3; do \
apt-get update && break || sleep 5; \
done && \
apt-get install -y --no-install-recommends ant git curl && \
rm -rf /var/lib/apt/lists/*
# compile YaCy
WORKDIR /opt
COPY . /opt/yacy_search_server/
# .git dir deleted here because .git is needed during the build to deterime the version,
# but isn't required at runtime
RUN ant compile -f /opt/yacy_search_server/build.xml \
&& rm -fr /opt/yacy_search_server/.git
# 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 arm64v8/openjdk:23-jdk-slim-bookworm AS app
RUN for i in 1 2 3; do \
apt-get update && break || sleep 5; \
done && \
apt-get install -y --no-install-recommends wkhtmltopdf xvfb ghostscript && \
rm -rf /var/lib/apt/lists/*
LABEL maintainer="Michael Peter Christen <mc@yacy.net>"
# copy YaCy to app image
RUN adduser --system --group --no-create-home --disabled-password 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
# Set data volume: yacy data and configuration will persist even after container stop or destruction
VOLUME ["/opt/yacy_search_server/DATA"]
# Next commands run as yacy as non-root user for improved security
USER yacy
# Start yacy as a foreground process (-f) to display console logs and to wait for yacy process
CMD ["/bin/sh","/opt/yacy_search_server/startYACY.sh","-f"]