services/templates/forgejo/Dockerfile.gotmpl
Dan Anglin 3340ddc475
build: automation with Go and Mage
We shall now use Go and Mage to manage the Flow services. The templates
have been converted to Go templates, Mage has replaced Make and the
helper bash scripts have been rewritten in Go.
2023-02-12 20:59:55 +00:00

44 lines
1.6 KiB
Docker

# This is a custom made Dockerfile for Gitea which is inspired from
# the official Dockerfile.rootless from https://github.com/go-gitea/gitea/
FROM alpine:3.17
ENV FORGEJO_WORK_DIR={{ .Forgejo.Work }} \
FORGEJO_CUSTOM={{ .Forgejo.Custom }} \
FORGEJO_APP_INI={{ .Forgejo.AppIni }} \
FORGEJO_BIN={{ .Forgejo.Bin }} \
FORGEJO_VERSION={{ .Forgejo.Version }} \
HOME={{ .Forgejo.Home }}
RUN apk update && apk upgrade && apk --no-cache add \
bash \
ca-certificates \
gettext \
git \
curl \
gnupg \
openssh-keygen \
&& addgroup -S -g {{ .FlowGID }} flow \
&& adduser -S -H -D -h {{ .Forgejo.Home }} -s /bin/bash -u {{ .Forgejo.LinuxUID }} -G flow git \
&& mkdir -p {{ .Forgejo.DataContainerDirectory }} {{ .Forgejo.Tmp }} \
&& chown git {{ .Forgejo.DataContainerDirectory }} && chmod 0700 {{ .Forgejo.DataContainerDirectory }} \
&& chown git {{ .Forgejo.Tmp }} && chmod 0700 {{ .Forgejo.Tmp }}
ADD --chown=root:root forgejo-{{ .Forgejo.Version }}-linux-amd64 {{ .Forgejo.Bin }}
ADD app.ini {{ .Forgejo.AppIni }}
ADD entrypoint.sh /usr/local/bin/entrypoint.sh
ADD --chown={{ .Forgejo.LinuxUID }}:{{ .FlowGID }} dynamic_git.yaml {{ .Forgejo.Tmp }}/
RUN chown -R {{ .Forgejo.LinuxUID }}:{{ .Forgejo.LinuxUID }} {{ .Forgejo.AppIni }} \
&& chmod 0400 {{ .Forgejo.AppIni }} \
&& chmod a+x {{ .Forgejo.Bin }} \
&& chmod a+rx /usr/local/bin/entrypoint.sh
USER {{ .Forgejo.LinuxUID }}:{{ .FlowGID }}
WORKDIR /flow/gitea/data
VOLUME ["/flow/gitea/data"]
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
CMD []