From f9664fd1edced5f719f0f181b9ea58a7ddd7510c Mon Sep 17 00:00:00 2001 From: gfxv Date: Mon, 3 Mar 2025 18:22:03 +0300 Subject: [PATCH] ops: add ci/cd for web app --- .gitea/workflows/demo.yml | 19 ------------------- .gitea/workflows/deploy.yml | 34 ++++++++++++++++++++++++++++++++++ Dockerfile | 6 ++++++ 3 files changed, 40 insertions(+), 19 deletions(-) delete mode 100644 .gitea/workflows/demo.yml create mode 100644 .gitea/workflows/deploy.yml create mode 100644 Dockerfile diff --git a/.gitea/workflows/demo.yml b/.gitea/workflows/demo.yml deleted file mode 100644 index c537cc6..0000000 --- a/.gitea/workflows/demo.yml +++ /dev/null @@ -1,19 +0,0 @@ -name: Gitea Actions Demo -run-name: ${{ gitea.actor }} is testing out Gitea Actions 🚀 -on: [push] - -jobs: - Explore-Gitea-Actions: - runs-on: ubuntu-latest - steps: - - run: echo "🎉 The job was automatically triggered by a ${{ gitea.event_name }} event." - - run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by Gitea!" - - run: echo "🔎 The name of your branch is ${{ gitea.ref }} and your repository is ${{ gitea.repository }}." - - name: Check out repository code - uses: actions/checkout@v4 - - run: echo "💡 The ${{ gitea.repository }} repository has been cloned to the runner." - - run: echo "🖥️ The workflow is now ready to test your code on the runner." - - name: List files in the repository - run: | - ls ${{ gitea.workspace }} - - run: echo "🍏 This job's status is ${{ job.status }}." diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml new file mode 100644 index 0000000..35d4079 --- /dev/null +++ b/.gitea/workflows/deploy.yml @@ -0,0 +1,34 @@ +name: Build and Deploy + +on: + push: + branches: + - master + +jobs: + build-and-deploy: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Login to Docker Registry + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + registry: docker-registry.internal.rferee.dev + + - name: Build and Push Docker Image + run: | + docker build -t docker-registry.internal.rferee.dev/gfxv/public/web . + docker push docker-registry.internal.rferee.dev/gfxv/public/web + + - name: Trigger Portainer Webhook + uses: peter-evans/http-post-action@v1 + with: + url: ${{ secrets.PORTAINER_WEBHOOK_URL }} + method: 'POST' + headers: 'Content-Type: application/json' + body: '{}' + diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..23275a5 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,6 @@ +FROM nginx:latest-alpine + +COPY ./src/ /usr/share/nginx/html/ + +EXPOSE 80 +