system-config/docker/gitea/Dockerfile
Clark Boylan 0d95d6114a Update gitea to 1.13.1
This bumps our golang image up to buster-1.15 from buster-1.14 as gitea
bumps their minimum to 1.13 and I figure we should keep up to date.

The templates are updated to accomodate the new gitea templates. Primary
changes here are removal of icon sizes when specified and using imported
templates to simplify bits of code we weren't changing anyway.

We install openssh-server from buster-backports on our gitea-ssh image.
The reason for this is we pull in gitea's sshd_config from gitea itself
and the updated gitea wants to set options that older openssh in buster
proper doesn't support. Accomodate this with the newer openssh found in
backports.

We add a new favicon.svg to override the new default gitea svg favicon
which is served otherwise.

One other thing to call out is that gitea 1.13.0 added support for
kanban and similar project management tooling. We have explicitly
disabled this along with the wiki, issues and pull requests via
app.ini's repository.DISABLE_REPO_UNITS setting. You can find out more
about this setting here:

  https://docs.gitea.io/en-us/config-cheat-sheet/#repository-repository

Change-Id: I4c483f90c7495ee1f80eacd2c79c38836aa6f483
2021-01-07 10:40:00 -08:00

123 lines
4.0 KiB
Docker

# Copyright (c) 2018 Red Hat, Inc.
# Copyright (c) 2016 The Gitea Authors
# Copyright (c) 2015 The Gogs Authors
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
###################################
#Build stage
FROM docker.io/library/golang:1.15-buster AS build-env
LABEL maintainer="infra-root@openstack.org"
ARG GITEA_VERSION="v1.13.1"
ENV TAGS "bindata $TAGS"
#Build deps
RUN apt-get update && apt-get -y install build-essential git apt-transport-https curl gnupg2 \
&& curl -sS https://deb.nodesource.com/gpgkey/nodesource.gpg.key | apt-key add - \
&& echo "deb https://deb.nodesource.com/node_10.x bionic main" | tee /etc/apt/sources.list.d/nodesource.list \
&& apt-get update \
&& apt-get -q --option "Dpkg::Options::=--force-confold" --assume-yes install nodejs \
&& mkdir -p ${GOPATH}/src/code.gitea.io/gitea
#Setup repo
RUN git clone https://github.com/go-gitea/gitea ${GOPATH}/src/code.gitea.io/gitea
WORKDIR ${GOPATH}/src/code.gitea.io/gitea
#Checkout version if set
RUN if [ -n "${GITEA_VERSION}" ]; then git checkout "${GITEA_VERSION}"; fi \
&& make clean-all build
###################################
# Basic system setup common to all containers in our pod
FROM docker.io/library/debian:buster-slim as base
RUN apt-get update && apt-get -y install \
bash \
ca-certificates \
curl \
gettext \
git \
openssh-client \
tzdata \
gnupg \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
RUN addgroup --system --gid 1000 git \
&& adduser \
--system --no-create-home --disabled-login \
--home /data/git \
--shell /bin/bash \
--uid 1000 \
--gid 1000 \
git \
&& echo "git:$(dd if=/dev/urandom bs=24 count=1 status=none | base64)" | chpasswd \
&& mkdir /custom
# Copy the /etc config files and entrypoint script
COPY --from=build-env /go/src/code.gitea.io/gitea/docker/root /
# Copy the app
COPY --from=build-env /go/src/code.gitea.io/gitea/gitea /app/gitea/gitea
RUN ln -s /app/gitea/gitea /usr/local/bin/gitea
# Copy our custom templates
COPY custom/ /custom/
ENV GITEA_CUSTOM /custom
###################################
# The gitea image
FROM base as gitea
RUN apt-get update && apt-get -y install pandoc \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
EXPOSE 3000
ENV USER git
VOLUME ["/data"]
ENTRYPOINT ["/usr/bin/entrypoint"]
CMD ["/app/gitea/gitea", "web"]
USER 1000:1000
###################################
# The openssh server image
FROM base as gitea-openssh
# We enable backports here to install newer openssh which includes
# support for options that gitea's ssh configuration expects
RUN echo 'deb http://deb.debian.org/debian buster-backports main' > /etc/apt/sources.list.d/backports.list
RUN apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get -y -o Dpkg::Options::="--force-confold" \
-t buster-backports install openssh-server \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* \
&& mkdir /run/sshd
COPY sshd-entrypoint.sh /usr/bin/entrypoint
EXPOSE 22
VOLUME ["/data"]
ENTRYPOINT ["/usr/bin/entrypoint"]
CMD ["/usr/sbin/sshd", "-D", "-e"]