From 0d5397a9dc7c2d2ea758d479ba0cf4723fe78b1b Mon Sep 17 00:00:00 2001 From: fraoustin Date: Sun, 24 Mar 2019 14:16:09 +0100 Subject: [PATCH 01/14] nginx: user nginx 1.15 --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index e97fdd0..fcb5046 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM nginx:1.13 +FROM nginx:1.15 LABEL maintainer "fraoustin@gmail.com" COPY ./src/default.conf /etc/nginx/conf.d/default.conf From 7e4253483dad765845d256390eab5c384bc10bed Mon Sep 17 00:00:00 2001 From: Youhei Sakurai Date: Mon, 29 Jul 2019 18:59:47 +0900 Subject: [PATCH 02/14] Add mime-support package (/etc/mime.types) to enable mime-wise raw preview --- Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Dockerfile b/Dockerfile index fcb5046..f029a48 100644 --- a/Dockerfile +++ b/Dockerfile @@ -17,6 +17,7 @@ RUN apt-get update && apt-get install -y \ gitweb \ highlight \ libcgi-pm-perl \ + mime-support \ spawn-fcgi \ && rm -rf /var/lib/apt/lists/* From 9661dc6564468f1ffea587e555e8fc6731000fa9 Mon Sep 17 00:00:00 2001 From: fraoustin Date: Wed, 5 Aug 2020 09:20:47 +0200 Subject: [PATCH 03/14] nginx: 1.19 --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index f029a48..b3ab0d7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM nginx:1.15 +FROM nginx:1.19 LABEL maintainer "fraoustin@gmail.com" COPY ./src/default.conf /etc/nginx/conf.d/default.conf From e6851ab438905023823e48b758b3e0d2b135aa00 Mon Sep 17 00:00:00 2001 From: fraoustin Date: Sat, 19 Feb 2022 16:58:26 +0000 Subject: [PATCH 04/14] nginx 1.21 --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index b3ab0d7..a7c57f1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM nginx:1.19 +FROM nginx:1.21 LABEL maintainer "fraoustin@gmail.com" COPY ./src/default.conf /etc/nginx/conf.d/default.conf From f6d2c106756ccc20fda8dcdcb112f93ab81727d9 Mon Sep 17 00:00:00 2001 From: ZCTMDC Date: Thu, 9 Jun 2022 12:40:07 +0800 Subject: [PATCH 05/14] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=20htpasswd=20=E5=9C=A8?= =?UTF-8?q?=E4=BD=8Elinux=E5=86=85=E6=A0=B8=E7=89=88=E6=9C=AC=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit fix bug 使用加密 ``` root@50b303640d95:/# htpasswd -nb uu pp > htpasswd: Unable to generate random bytes: Function not implemented ``` 尝试不使用加密 use -p > -p Do not encrypt the password (plaintext, insecure). ``` root@50b303640d95:/# htpasswd -npb uu pp > Warning: storing passwords as plain text might just not work on this platform. uu:pp ``` 测试正常 --- src/cmd/addauth.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/cmd/addauth.sh b/src/cmd/addauth.sh index 3e1e905..6079cf2 100644 --- a/src/cmd/addauth.sh +++ b/src/cmd/addauth.sh @@ -13,9 +13,11 @@ usage(){ load(){ if [ ! -f $FPASS ]; then - htpasswd -bc $FPASS $1 $2 - else - htpasswd -b $FPASS $1 $2 + touch $FPASS + fi + htpasswd -b $FPASS $1 $2 + if [ "$?" != 0 ] ; then + htpasswd -bp $FPASS $1 $2 fi } From 8d14ec90715a29c5f21009884c0e4f72b1ee2403 Mon Sep 17 00:00:00 2001 From: ZCTMDC Date: Thu, 9 Jun 2022 14:16:55 +0800 Subject: [PATCH 06/14] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=20htpasswd=20=E6=98=8E?= =?UTF-8?q?=E6=96=87=E5=AF=86=E7=A0=81=E4=B8=8D=E5=8F=AF=E7=94=A8bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修复 htpasswd 明文密码不可用bug: - `ningx` 在 `Linux` 中使用 `htpasswd`` 明文密码不可用 - 使用 `openssl passwd -apr1` 创建密码 --- src/cmd/addauth.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/cmd/addauth.sh b/src/cmd/addauth.sh index 6079cf2..b5381f0 100644 --- a/src/cmd/addauth.sh +++ b/src/cmd/addauth.sh @@ -17,7 +17,8 @@ load(){ fi htpasswd -b $FPASS $1 $2 if [ "$?" != 0 ] ; then - htpasswd -bp $FPASS $1 $2 + htpasswd -D $FPASS $1 + printf "$1:$(openssl passwd -apr1 $2)\n" >> $FPASS fi } From 6c31b12cef91870b25c0cd33d6c7ebef18ad25fc Mon Sep 17 00:00:00 2001 From: ZCTMDC Date: Sun, 19 Jun 2022 15:16:55 +0800 Subject: [PATCH 07/14] UPDATE DOCKERFILE --- Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Dockerfile b/Dockerfile index a7c57f1..2c3e349 100644 --- a/Dockerfile +++ b/Dockerfile @@ -51,6 +51,7 @@ RUN cp /usr/share/gitweb/static/gitweb.css /usr/share/gitweb/static/gitweb.css.o RUN mkdir /usr/share/gitweb/ihm VOLUME /var/lib/git +WORKDIR /var/lib/git EXPOSE 80 ENTRYPOINT ["/entrypoint.sh"] From 43fcd3e6776c5ac23d431b2b4cfd1d62970422e5 Mon Sep 17 00:00:00 2001 From: ZCTMDC Date: Sun, 19 Jun 2022 15:19:37 +0800 Subject: [PATCH 08/14] add description --- src/cmd/addrepos.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/src/cmd/addrepos.sh b/src/cmd/addrepos.sh index ca318d4..976bec8 100644 --- a/src/cmd/addrepos.sh +++ b/src/cmd/addrepos.sh @@ -17,6 +17,7 @@ load(){ mkdir $REPOS cd $REPOS git init --bare + echo "$1" > description chmod -R 777 $REPOS fi } From b29d168738fdb289fddaefc25514ba99bec7235b Mon Sep 17 00:00:00 2001 From: fraoustin Date: Fri, 1 Jul 2022 12:11:05 +0000 Subject: [PATCH 09/14] new version and nginx 1.23 --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 2c3e349..197c110 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM nginx:1.21 +FROM nginx:1.23 LABEL maintainer "fraoustin@gmail.com" COPY ./src/default.conf /etc/nginx/conf.d/default.conf From 3c64299f1521176aa33f3ab7a43a0ae57418a8e3 Mon Sep 17 00:00:00 2001 From: ZCTMDC Date: Fri, 18 Nov 2022 01:39:44 +0800 Subject: [PATCH 10/14] add: compose file simple --- docker-compose.yaml | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 docker-compose.yaml diff --git a/docker-compose.yaml b/docker-compose.yaml new file mode 100644 index 0000000..1d69e81 --- /dev/null +++ b/docker-compose.yaml @@ -0,0 +1,23 @@ +version: "3" + +volumes: + gitweb: + + +services: + gitweb: + image: fraoustin/gitweb + container_name: gitweb + hostname: gitweb + environment: + - SET_CONTAINER_TIMEZONE=true + - CONTAINER_TIMEZONE=Europe/Paris + - GITPROJECT=test + - GITUSER=gituser + - GITPASSWORD=gitpassword + - IHM="" + ports: + - 8080:80 + restart: always + volumes: + - gitweb:/var/lib/git/ From 327962bc3296bd61366d1cd0a676892c3d0f528d Mon Sep 17 00:00:00 2001 From: ZCTMDC Date: Fri, 18 Nov 2022 01:40:10 +0800 Subject: [PATCH 11/14] add: workflows file --- .github/workflows/docker-publish.yml | 117 +++++++++++++++++++++++++++ 1 file changed, 117 insertions(+) create mode 100644 .github/workflows/docker-publish.yml diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml new file mode 100644 index 0000000..bdf3568 --- /dev/null +++ b/.github/workflows/docker-publish.yml @@ -0,0 +1,117 @@ +name: Docker + +# This workflow uses actions that are not certified by GitHub. +# They are provided by a third-party and are governed by +# separate terms of service, privacy policy, and support +# documentation. + +on: + push: + branches: ["master", "develop"] + # Publish semver tags as releases. + tags: ["v*.*.*"] + pull_request: + branches: ["master", "develop"] + +env: + # Use docker.io for Docker Hub if empty + # REGISTRY: ghcr.io + REGISTRY: docker.io + # github.repository as / + APP_NAME: gitweb + +jobs: + build: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + # This is used to complete the identity challenge + # with sigstore/fulcio when running outside of PRs. + id-token: write + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 + + # Install the cosign tool except on PR + # https://github.com/sigstore/cosign-installer + - name: Install cosign + if: github.event_name != 'pull_request' + uses: sigstore/cosign-installer@main + with: + cosign-release: "v1.13.1" + + # Workaround: https://github.com/docker/build-push-action/issues/461 + - name: Setup Docker buildx + uses: docker/setup-buildx-action@v2 + + # Login against a Docker registry except on PR + # https://github.com/docker/login-action + - name: Log into registry ${{ env.REGISTRY }} + if: github.event_name != 'pull_request' + uses: docker/login-action@v2 + with: + registry: ${{ env.REGISTRY }} + username: ${{ secrets.REGISTRY_USERNAME }} + password: ${{ secrets.REGISTRY_TOKEN }} + + # Extract metadata (tags, labels) for Docker + # https://github.com/docker/metadata-action + - name: Extract Docker metadata + id: meta + if: github.event_name != 'pull_request' + uses: docker/metadata-action@v4 + with: + images: ${{ env.REGISTRY }}/${{ secrets.REGISTRY_USERNAME }}/${{ env.APP_NAME }} + tags: | + type=ref,event=branch + type=ref,event=tag + type=pep440,pattern={{version}} + + # Build and push Docker image with Buildx (don't push on PR) + # https://github.com/docker/build-push-action + - name: Build and load Docker image + id: build-and-load + uses: docker/build-push-action@v3 + with: + context: . + load: true + tags: ${{ secrets.REGISTRY_USERNAME }}/${{ env.APP_NAME }}:test + no-cache: true + + - name: Test Docker image + run: | + docker run -d -e "GITPROJECT=test" -v $(pwd)/test:/test --name test ${{ secrets.REGISTRY_USERNAME }}/${{ env.APP_NAME }}:test + sleep 15 + docker exec -i ${{ secrets.REGISTRY_USERNAME }}/${{ env.APP_NAME }}:test chmod +x /test/load.sh + docker exec -i ${{ secrets.REGISTRY_USERNAME }}/${{ env.APP_NAME }}:test /test/load.sh + + - name: Build and push Docker image + if: github.event_name != 'pull_request' + id: build-and-push + uses: docker/build-push-action@v3 + with: + context: . + push: ${{ github.event_name != 'pull_request' }} + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + platforms: linux/386,linux/arm/v7,linux/amd64,linux/arm64/v8 + cache-from: type=registry,ref=${{ env.REGISTRY }}/${{ secrets.REGISTRY_USERNAME }}/${{ env.APP_NAME }}:buildcache + cache-to: type=registry,ref=${{ env.REGISTRY }}/${{ secrets.REGISTRY_USERNAME }}/${{ env.APP_NAME }}:buildcache,mode=max + + # Sign the resulting Docker image digest except on PRs. + # This will only write to the public Rekor transparency log when the Docker + # repository is public to avoid leaking data. If you would like to publish + # transparency data even for private images, pass --force to cosign below. + # https://github.com/sigstore/cosign + - name: Sign the published Docker image + if: ${{ github.event_name != 'pull_request' }} + env: + COSIGN_EXPERIMENTAL: "true" + # This step uses the identity token to provision an ephemeral certificate + # against the sigstore community Fulcio instance. + run: echo "${{ steps.meta.outputs.tags }}" | xargs -I {} cosign sign {}@${{ steps.build-and-push.outputs.digest }} From d15f4ecd0ec1ab01c73e632a1cbd51b9170a8b72 Mon Sep 17 00:00:00 2001 From: ZCTMDC Date: Fri, 18 Nov 2022 01:47:54 +0800 Subject: [PATCH 12/14] fixbug: test docker container name --- .github/workflows/docker-publish.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index bdf3568..3038422 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -85,10 +85,10 @@ jobs: - name: Test Docker image run: | - docker run -d -e "GITPROJECT=test" -v $(pwd)/test:/test --name test ${{ secrets.REGISTRY_USERNAME }}/${{ env.APP_NAME }}:test + docker run -d -e "GITPROJECT=test" -v $(pwd)/test:/test --name gitweb-test ${{ secrets.REGISTRY_USERNAME }}/${{ env.APP_NAME }}:test sleep 15 - docker exec -i ${{ secrets.REGISTRY_USERNAME }}/${{ env.APP_NAME }}:test chmod +x /test/load.sh - docker exec -i ${{ secrets.REGISTRY_USERNAME }}/${{ env.APP_NAME }}:test /test/load.sh + docker exec -i gitweb-test chmod +x /test/load.sh + docker exec -i gitweb-test /test/load.sh - name: Build and push Docker image if: github.event_name != 'pull_request' From 57e464c8b761d68834e1ecfc6c56e98a8b43417a Mon Sep 17 00:00:00 2001 From: ZCTMDC Date: Fri, 18 Nov 2022 01:51:47 +0800 Subject: [PATCH 13/14] fixbug: default port is 80. --- test/load.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/load.sh b/test/load.sh index 07dac22..5b8e9ea 100755 --- a/test/load.sh +++ b/test/load.sh @@ -1,6 +1,6 @@ #!/bin/bash cd /tmp -git clone http://gituser:gitpassword@localhost:8080/test.git +git clone http://gituser:gitpassword@localhost:80/test.git cd test git branch master git checkout master From 84f1bf018d778e840a3914896a4f1b31401eed5c Mon Sep 17 00:00:00 2001 From: ZCTMDC Date: Fri, 18 Nov 2022 01:56:16 +0800 Subject: [PATCH 14/14] fixbug: unable to auto-detect email address on test --- test/load.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/load.sh b/test/load.sh index 5b8e9ea..43dac3e 100755 --- a/test/load.sh +++ b/test/load.sh @@ -1,4 +1,6 @@ #!/bin/bash +git config --global user.email "you@example.com" +git config --global user.name "Your Name" cd /tmp git clone http://gituser:gitpassword@localhost:80/test.git cd test