fix: easily deploy specific versions of Gitea
Update templates and add a helper script to download and build the version of Gitea that is specified in the configuration file.
This commit is contained in:
parent
cf13a5300b
commit
f2a5829aed
4 changed files with 48 additions and 29 deletions
16
.helpers/download-gitea.sh
Normal file
16
.helpers/download-gitea.sh
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
set -o errexit
|
||||||
|
set -o nounset
|
||||||
|
set -o pipefail
|
||||||
|
|
||||||
|
export $(cat ./config/flow-platform.cfg | grep GITEA_VERSION | tr -d "\"")
|
||||||
|
|
||||||
|
if ! [ -f ./build/gitea/gitea-${GITEA_VERSION}-linux-amd64 ]; then
|
||||||
|
echo "Downloading Gitea ${GITEA_VERSION}..."
|
||||||
|
curl -sSL https://dl.gitea.io/gitea/${GITEA_VERSION}/gitea-${GITEA_VERSION}-linux-amd64 -o ./build/gitea/gitea-${GITEA_VERSION}-linux-amd64
|
||||||
|
curl -sSL https://dl.gitea.io/gitea/${GITEA_VERSION}/gitea-${GITEA_VERSION}-linux-amd64.sha256 -o ./build/gitea/gitea-${GITEA_VERSION}-linux-amd64.sha256
|
||||||
|
( cd ./build/gitea && sha256sum --check gitea-${GITEA_VERSION}-linux-amd64.sha256 )
|
||||||
|
else
|
||||||
|
echo "Gitea ${GITEA_VERSION} is already present."
|
||||||
|
fi
|
7
Makefile
7
Makefile
|
@ -1,4 +1,4 @@
|
||||||
all: compose traefik gitea
|
all: traefik gitea
|
||||||
|
|
||||||
compose:
|
compose:
|
||||||
bash ./.helpers/render.sh compose
|
bash ./.helpers/render.sh compose
|
||||||
|
@ -6,5 +6,8 @@ compose:
|
||||||
traefik: compose
|
traefik: compose
|
||||||
bash ./.helpers/render.sh traefik
|
bash ./.helpers/render.sh traefik
|
||||||
|
|
||||||
gitea: compose
|
gitea: gitea-binary compose
|
||||||
bash ./.helpers/render.sh gitea
|
bash ./.helpers/render.sh gitea
|
||||||
|
|
||||||
|
gitea-binary:
|
||||||
|
bash ./.helpers/download-gitea.sh
|
||||||
|
|
|
@ -17,7 +17,7 @@ services:
|
||||||
# -- Traffic flow --
|
# -- Traffic flow --
|
||||||
traefik:
|
traefik:
|
||||||
container_name: "traffic-flow"
|
container_name: "traffic-flow"
|
||||||
image: flow-traefik
|
image: localhost/flow/traefik:${TRAEFIK_VERSION}
|
||||||
build:
|
build:
|
||||||
context: "../traefik"
|
context: "../traefik"
|
||||||
networks:
|
networks:
|
||||||
|
@ -56,7 +56,7 @@ services:
|
||||||
# -- Code flow --
|
# -- Code flow --
|
||||||
gitea:
|
gitea:
|
||||||
container_name: "code-flow"
|
container_name: "code-flow"
|
||||||
image: flow-gitea
|
image: localhost/flow/gitea:${GITEA_VERSION}
|
||||||
build:
|
build:
|
||||||
context: "../gitea"
|
context: "../gitea"
|
||||||
expose:
|
expose:
|
||||||
|
|
|
@ -2,37 +2,37 @@
|
||||||
# the official Dockerfile.rootless from https://github.com/go-gitea/gitea/
|
# the official Dockerfile.rootless from https://github.com/go-gitea/gitea/
|
||||||
FROM alpine:3.16
|
FROM alpine:3.16
|
||||||
|
|
||||||
RUN apk --no-cache add \
|
|
||||||
bash \
|
|
||||||
ca-certificates \
|
|
||||||
gettext \
|
|
||||||
git \
|
|
||||||
curl \
|
|
||||||
gnupg \
|
|
||||||
openssh-keygen
|
|
||||||
|
|
||||||
RUN addgroup -S -g ${FLOW_GID} flow && \
|
|
||||||
adduser -S -H -D -h ${GITEA_HOME} -s /bin/bash -u ${GITEA_FLOW_UID} -G flow git && \
|
|
||||||
mkdir -p ${GITEA_DATA_CONTAINER_DIR} ${GITEA_TMP} && \
|
|
||||||
chown git ${GITEA_DATA_CONTAINER_DIR} && chmod 0700 ${GITEA_DATA_CONTAINER_DIR} && \
|
|
||||||
chown git ${GITEA_TMP} && chmod 0700 ${GITEA_TMP}
|
|
||||||
|
|
||||||
ADD --chown=root:root gitea ${GITEA_BIN}
|
|
||||||
ADD app.ini ${GITEA_APP_INI}
|
|
||||||
ADD entrypoint.sh /usr/local/bin/entrypoint.sh
|
|
||||||
ADD --chown=${GITEA_FLOW_UID}:${FLOW_GID} dynamic_git.yaml ${GITEA_TMP}/
|
|
||||||
|
|
||||||
RUN chown -R ${GITEA_FLOW_UID}:${GITEA_FLOW_UID} ${GITEA_APP_INI} && \
|
|
||||||
chmod 0400 ${GITEA_APP_INI} && \
|
|
||||||
chmod a+x ${GITEA_BIN} && \
|
|
||||||
chmod a+rx /usr/local/bin/entrypoint.sh
|
|
||||||
|
|
||||||
ENV GITEA_WORK_DIR=${GITEA_WORK_DIR} \
|
ENV GITEA_WORK_DIR=${GITEA_WORK_DIR} \
|
||||||
GITEA_CUSTOM=${GITEA_CUSTOM} \
|
GITEA_CUSTOM=${GITEA_CUSTOM} \
|
||||||
GITEA_APP_INI=${GITEA_APP_INI} \
|
GITEA_APP_INI=${GITEA_APP_INI} \
|
||||||
GITEA_BIN=${GITEA_BIN} \
|
GITEA_BIN=${GITEA_BIN} \
|
||||||
|
GITEA_VERSION=${GITEA_VERSION} \
|
||||||
HOME=${GITEA_HOME}
|
HOME=${GITEA_HOME}
|
||||||
|
|
||||||
|
RUN apk update && apk --no-cache add \
|
||||||
|
bash \
|
||||||
|
ca-certificates \
|
||||||
|
gettext \
|
||||||
|
git \
|
||||||
|
curl \
|
||||||
|
gnupg \
|
||||||
|
openssh-keygen \
|
||||||
|
&& addgroup -S -g ${FLOW_GID} flow \
|
||||||
|
&& adduser -S -H -D -h ${GITEA_HOME} -s /bin/bash -u ${GITEA_FLOW_UID} -G flow git \
|
||||||
|
&& mkdir -p ${GITEA_DATA_CONTAINER_DIR} ${GITEA_TMP} \
|
||||||
|
&& chown git ${GITEA_DATA_CONTAINER_DIR} && chmod 0700 ${GITEA_DATA_CONTAINER_DIR} \
|
||||||
|
&& chown git ${GITEA_TMP} && chmod 0700 ${GITEA_TMP}
|
||||||
|
|
||||||
|
ADD --chown=root:root gitea-${GITEA_VERSION}-linux-amd64 ${GITEA_BIN}
|
||||||
|
ADD app.ini ${GITEA_APP_INI}
|
||||||
|
ADD entrypoint.sh /usr/local/bin/entrypoint.sh
|
||||||
|
ADD --chown=${GITEA_FLOW_UID}:${FLOW_GID} dynamic_git.yaml ${GITEA_TMP}/
|
||||||
|
|
||||||
|
RUN chown -R ${GITEA_FLOW_UID}:${GITEA_FLOW_UID} ${GITEA_APP_INI} \
|
||||||
|
&& chmod 0400 ${GITEA_APP_INI} \
|
||||||
|
&& chmod a+x ${GITEA_BIN} \
|
||||||
|
&& chmod a+rx /usr/local/bin/entrypoint.sh
|
||||||
|
|
||||||
USER ${GITEA_FLOW_UID}:${FLOW_GID}
|
USER ${GITEA_FLOW_UID}:${FLOW_GID}
|
||||||
|
|
||||||
WORKDIR /flow/gitea/data
|
WORKDIR /flow/gitea/data
|
||||||
|
|
Loading…
Reference in a new issue