diff --git a/.drone/build.sh b/.drone/build.sh index 83f8194..4b16d55 100644 --- a/.drone/build.sh +++ b/.drone/build.sh @@ -2,4 +2,4 @@ sleep 10 docker build gitea \ --build-arg REGISTRY=${REGISTRY_DOMAIN}:${REGISTRY_PORT}/${ROOT}/${NAME}/ \ - -t ${REGISTRY_DOMAIN}:${REGISTRY_PORT}/${ROOT}/${NAME}/gitea + -t ${REGISTRY_DOMAIN}:${REGISTRY_PORT}/${ROOT}/${NAME}/gitea:$1 diff --git a/.drone/deploy.sh b/.drone/deploy.sh index 11bdc15..489700f 100644 --- a/.drone/deploy.sh +++ b/.drone/deploy.sh @@ -1,4 +1,6 @@ export LOCAL_DOCKER_REGISTRY=${REGISTRY_DOMAIN}:${REGISTRY_PORT}/${ROOT}/${NAME}/ \ +&& echo $1 \ +&& export TAG=$1 \ && docker stack rm gitea \ && echo 'sleeping...zzz' \ && sleep 60 \ diff --git a/.drone/drone-home.yml b/.drone/drone-home.yml index fd4beb4..041cad6 100644 --- a/.drone/drone-home.yml +++ b/.drone/drone-home.yml @@ -228,8 +228,8 @@ steps: - export NAME=gitea - export ROOT=stack - "n=0\nwhile :\ndo\n docker login $${REGISTRY_DOMAIN}:$${REGISTRY_PORT}/ --username client --password \"$${REGISTRY_PASSWORD}\" \\\\\n && break # substitute your command here\n n=$((n+1))\n if [ $n -ge 10 ]; then\n echo \"login failed\"\n exit 1\n fi\n echo \"retrying login..$n\"\n sleep 5\ndone\n" - - sh .drone/build.sh - - sh .drone/push.sh + - sh .drone/build.sh ${DRONE_COMMIT_SHA} + - sh .drone/push.sh ${DRONE_COMMIT_SHA} volumes: - name: dockersock path: /var/run @@ -257,16 +257,21 @@ volumes: path: /etc/docker/daemon.json trigger: - event: - - promote - target: - - build + branch: + - separate-database + #event: + #- promote + #target: + #- build --- kind: pipeline type: docker name: deploy +depends_on: +- build + platform: os: linux arch: amd64 @@ -286,6 +291,7 @@ steps: envs: - drone_tag - drone_commit + - drone_commit_sha - drone_build_number - drone_repo_name - drone_repo_namespace @@ -325,8 +331,9 @@ steps: - export ROOT=stack - cd /stack/gitea - "n=0\nwhile :\ndo\n docker login $${REGISTRY_DOMAIN}:$${REGISTRY_PORT}/ --username client --password \"$${REGISTRY_PASSWORD}\" \\\\\n && break # substitute your command here\n n=$((n+1))\n if [ $n -ge 10 ]; then\n echo \"login failed\"\n exit 1\n fi\n echo \"retrying login..$n\"\n sleep 5\ndone\n" - - sh .drone/pull.sh - - sh .drone/deploy.sh + - printenv + - sh .drone/pull.sh ${DRONE_COMMIT_SHA} + - sh .drone/deploy.sh ${DRONE_COMMIT_SHA} environment: GITEA_APP_NAME: from_secret: gitea-app-name @@ -350,9 +357,11 @@ steps: from_secret: gitea-server-lfs-jwt-secret trigger: - event: - - promote - target: - - deploy + branch: + - separate-database + #event: + #- promote + #target: + #- deploy ... diff --git a/.drone/pull.sh b/.drone/pull.sh index e52add2..f296aaf 100644 --- a/.drone/pull.sh +++ b/.drone/pull.sh @@ -1 +1 @@ -docker pull ${REGISTRY_DOMAIN}:${REGISTRY_PORT}/${ROOT}/${NAME}/gitea +docker pull ${REGISTRY_DOMAIN}:${REGISTRY_PORT}/${ROOT}/${NAME}/gitea:$1 diff --git a/.drone/push.sh b/.drone/push.sh index 7922e60..d569c2a 100644 --- a/.drone/push.sh +++ b/.drone/push.sh @@ -1 +1 @@ -docker push ${REGISTRY_DOMAIN}:${REGISTRY_PORT}/${ROOT}/${NAME}/gitea +docker push ${REGISTRY_DOMAIN}:${REGISTRY_PORT}/${ROOT}/${NAME}/gitea:$1 diff --git a/docker-compose.yml b/docker-compose.yml index b87a3ca..4a273e4 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -7,7 +7,7 @@ services: replicas: 1 restart_policy: condition: any - image: ${LOCAL_DOCKER_REGISTRY}gitea + image: ${LOCAL_DOCKER_REGISTRY}gitea:${TAG} environment: - USER_UID=1000 - USER_GID=1000 diff --git a/gitea/Dockerfile b/gitea/Dockerfile index 911aca3..13192f2 100644 --- a/gitea/Dockerfile +++ b/gitea/Dockerfile @@ -1,5 +1,5 @@ ARG REGISTRY -FROM ${REGISTRY}gitea/gitea:1.12.3-linux-amd64 +FROM gitea/gitea:1.20.5-linux-amd64 COPY app.ini /init/ COPY ./templates /init/templates/ COPY run.sh / diff --git a/gitea/templates/home.tmpl b/gitea/templates/home.tmpl index 8339d0c..578c67b 100644 --- a/gitea/templates/home.tmpl +++ b/gitea/templates/home.tmpl @@ -3,7 +3,7 @@