Commit 6fb3512f authored by ale's avatar ale
Browse files

Merge branch 'build-on-bullseye' into 'master'

Build on Debian Bullseye

See merge request !13
parents 0718d949 9c32712a
Pipeline #12473 passed with stages
in 1 minute and 32 seconds
FROM debian:stable AS build
FROM debian:bullseye AS build
RUN apt-get -q update && env DEBIAN_FRONTEND=noninteractive apt-get -qy install --no-install-recommends rsync git golang ca-certificates
ADD . /src
RUN apt-get -q update && env DEBIAN_FRONTEND=noninteractive apt-get -qy install --no-install-recommends rsync git golang ca-certificates && cd /src && ./scripts/lint.sh && ./scripts/update.sh
WORKDIR /src
RUN ./scripts/lint.sh && ./scripts/update.sh
FROM registry.git.autistici.org/ai3/docker/apache2-base:buster
COPY --from=build /src/public /var/www/autistici.org
COPY --from=build /src/build/bin/sitesearch /usr/sbin/sitesearch
COPY --from=build /root/go/bin/sitesearch /usr/sbin/sitesearch
COPY --from=build /src/index /var/lib/sitesearch/index
COPY templates /var/lib/sitesearch/templates
COPY docker/conf /tmp/conf
......
......@@ -20,22 +20,18 @@ is_installed() {
# We can use the installed version of some tools, or invoke 'go get'
# to build them locally (if Go is installed).
find_or_install() {
find_or_install_go_pkg() {
local bin="$1"
local url="$2"
local relpath="${3:-}"
if is_installed "${bin}" ; then
echo "${bin}"
else
if [ ! -x "${GOPATH}/bin/${bin}" ]; then
echo "Installing ${url}" >&2
# Go needs to be installed.
is_installed go || die "Go needs to be installed. See https://golang.org/dl/"
go get -u -d ${url} >&2 || true
go install ${url}/${relpath} \
|| die "Could not install ${bin}"
fi
echo "${GOPATH}/bin/${bin}"
echo "Installing ${url}" >&2
# Go needs to be installed.
is_installed go || die "Go needs to be installed. See https://golang.org/dl/"
go get -u ${url} >&2 \
|| die "Could not install ${bin} (${url})"
find_installed "${bin}"
fi
}
......@@ -67,16 +63,17 @@ update_website() {
msg "checking prerequisites"
# In case we need to build some Go packages locally, set GOPATH to
# point at the 'build' subdirectory of root_dir.
# Build and install Go packages with a sufficiently recent
# version of Go which understands modules and can ignore GOPATH.
build_dir="${root_dir}/build"
mkdir -p "${build_dir}"
export GOPATH="${build_dir}"
export PATH="$PATH:$GOPATH/bin"
unset GOPATH
export PATH="$PATH:$HOME/go/bin"
export GO111MODULE=on
# Install the required Go utilities.
gostatic=$(find_or_install gostatic github.com/piranha/gostatic)
sitesearch=$(find_or_install sitesearch git.autistici.org/ai/webtools cmd/...)
gostatic=$(find_or_install_go_pkg gostatic github.com/piranha/gostatic)
sitesearch=$(find_or_install_go_pkg sitesearch git.autistici.org/ai/webtools/...)
test -d "${site_dir}" || mkdir -p "${site_dir}"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment