From 15994778bd983c496cacdc3f3e77a4eab1ce8b66 Mon Sep 17 00:00:00 2001 From: Snowykami Date: Thu, 17 Jul 2025 03:44:17 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=20CI=20=E5=B7=A5=E4=BD=9C?= =?UTF-8?q?=E6=B5=81=E5=92=8C=20Docker=20Compose=20=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E4=BB=A5=E6=9E=84=E5=BB=BA=E5=92=8C=E9=83=A8=E7=BD=B2=E5=AE=B9?= =?UTF-8?q?=E5=99=A8=E9=95=9C=E5=83=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitea/workflows/ci.yaml | 53 ++++++++++++++++++++++++++++++++++++++++ docker-compose.yaml | 11 +++++++++ 2 files changed, 64 insertions(+) create mode 100644 .gitea/workflows/ci.yaml create mode 100644 docker-compose.yaml diff --git a/.gitea/workflows/ci.yaml b/.gitea/workflows/ci.yaml new file mode 100644 index 0000000..c419e79 --- /dev/null +++ b/.gitea/workflows/ci.yaml @@ -0,0 +1,53 @@ +name: Build and Push Container Image, Deploy to Host + +on: + push: + branches: [main] + workflow_dispatch: + +permissions: + contents: write + +concurrency: + group: docker-build + cancel-in-progress: false + +env: + CONTAINER_TAG: reg.liteyuki.org/liteyuki/new-domain-redir:latest + +jobs: + build-and-push-and-deploy: + runs-on: liteyukios-latest + steps: + - name: Checkout code + uses: https://git.liteyuki.org/actions/checkout@v4 + + - name: Set up Docker TLS + run: | + mkdir -p /certs + echo "${{ secrets.DOCKER_TLS_CA }}" > /certs/ca.pem + echo "${{ secrets.DOCKER_TLS_CERT }}" > /certs/cert.pem + echo "${{ secrets.DOCKER_TLS_KEY }}" > /certs/key.pem + chmod 600 /certs/key.pem + echo "Docker TLS setup complete." + + + - name: Log in to Liteyuki Harbor + uses: docker/login-action@v3 + with: + registry: reg.liteyuki.org + username: ${{ secrets.LCR_USERNAME }} + password: ${{ secrets.LCR_PASSWORD }} + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + + - name: Build and push container image + run: | + docker build -t ${{ env.CONTAINER_TAG }} . + docker push ${{ env.CONTAINER_TAG }} + + + - name: Update container image on host + run: | + docker compose -f ./docker-compose.yaml up -d --force-recreate --pull always \ No newline at end of file diff --git a/docker-compose.yaml b/docker-compose.yaml new file mode 100644 index 0000000..d38ee35 --- /dev/null +++ b/docker-compose.yaml @@ -0,0 +1,11 @@ +services: + domain-redir: + image: reg.liteyuki.org/liteyuki/new-domain-redir:latest + restart: always + container_name: domain-redir + networks: + - liteyuki-network + +networks: + liteyuki-network: + external: true