From 47256ecf19d744a810d7e2275230641958fa519e Mon Sep 17 00:00:00 2001 From: H4CK3R-01 Date: Mon, 27 Mar 2023 23:18:09 +0200 Subject: [PATCH] Use Gitea actions instead of woodpecker --- .gitea/workflows/build-backend.yaml | 43 +++++++++++++++++++++++++ .gitea/workflows/build-frontend.yaml | 43 +++++++++++++++++++++++++ .woodpecker.yml | 48 ---------------------------- docker-compose.yml | 4 +-- 4 files changed, 88 insertions(+), 50 deletions(-) create mode 100644 .gitea/workflows/build-backend.yaml create mode 100644 .gitea/workflows/build-frontend.yaml delete mode 100644 .woodpecker.yml diff --git a/.gitea/workflows/build-backend.yaml b/.gitea/workflows/build-backend.yaml new file mode 100644 index 0000000..256d927 --- /dev/null +++ b/.gitea/workflows/build-backend.yaml @@ -0,0 +1,43 @@ +name: Build & Publish Backend +on: + push: + paths: + - backend +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Check out the repo + uses: actions/checkout@v3 + + - name: Docker meta + id: meta + uses: https://github.com/docker/metadata-action@v4 + with: + images: git.flokaiser.com/dhbw/cloud-computing-backend + tags: | + type=sha,enable=true,priority=100,prefix={{branch}}-,suffix=,format=short + type=raw,value=latest,enable={{is_default_branch}} + + - name: Get get-docker.sh + run: curl -fsSL https://get.docker.com -o get-docker.sh + + - name: Install docker + run: sh get-docker.sh + + - name: Login to Registry + uses: docker/login-action@v2 + with: + registry: git.flokaiser.com + username: ${{ secrets.REGISTRY_USERNAME }} + password: ${{ secrets.REGISTRY_TOKEN }} + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + + - name: Build and push + uses: docker/build-push-action@v4 + with: + platforms: linux/amd64 + push: true + tags: ${{ steps.meta.outputs.tags }} \ No newline at end of file diff --git a/.gitea/workflows/build-frontend.yaml b/.gitea/workflows/build-frontend.yaml new file mode 100644 index 0000000..f08533a --- /dev/null +++ b/.gitea/workflows/build-frontend.yaml @@ -0,0 +1,43 @@ +name: Build & Publish Backend +on: + push: + paths: + - frontend +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Check out the repo + uses: actions/checkout@v3 + + - name: Docker meta + id: meta + uses: https://github.com/docker/metadata-action@v4 + with: + images: git.flokaiser.com/dhbw/cloud-computing-frontend + tags: | + type=sha,enable=true,priority=100,prefix={{branch}}-,suffix=,format=short + type=raw,value=latest,enable={{is_default_branch}} + + - name: Get get-docker.sh + run: curl -fsSL https://get.docker.com -o get-docker.sh + + - name: Install docker + run: sh get-docker.sh + + - name: Login to Registry + uses: docker/login-action@v2 + with: + registry: git.flokaiser.com + username: ${{ secrets.REGISTRY_USERNAME }} + password: ${{ secrets.REGISTRY_TOKEN }} + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + + - name: Build and push + uses: docker/build-push-action@v4 + with: + platforms: linux/amd64 + push: true + tags: ${{ steps.meta.outputs.tags }} \ No newline at end of file diff --git a/.woodpecker.yml b/.woodpecker.yml deleted file mode 100644 index ef820b3..0000000 --- a/.woodpecker.yml +++ /dev/null @@ -1,48 +0,0 @@ -pipeline: - generate_docker_tag: - image: golang - commands: - - echo -n "${CI_COMMIT_BRANCH//\//-}-${CI_COMMIT_SHA:0:8}, latest" > .tags - when: - path: [ "frontend/**", "backend/**", "proxy/**" ] - event: push - - - # -------------------------------------- Backend -------------------------------------- - build_backend: - image: woodpeckerci/plugin-docker-buildx - settings: - repo: - from_secret: repository_backend - username: - from_secret: registry_username - password: - from_secret: registry_password - registry: - from_secret: registry - dockerfile: Dockerfile.Backend - platforms: linux/amd64 - when: - path: "backend/**" - event: push - - - # -------------------------------------- Frontend -------------------------------------- - build_frontend: - image: woodpeckerci/plugin-docker-buildx - settings: - repo: - from_secret: repository_frontend - username: - from_secret: registry_username - password: - from_secret: registry_password - registry: - from_secret: registry - dockerfile: Dockerfile.Frontend - platforms: linux/amd64 - when: - path: "frontend/**" - event: push - -branches: main diff --git a/docker-compose.yml b/docker-compose.yml index 7cab45e..de6bc38 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -14,11 +14,11 @@ services: - ./proxy:/etc/nginx/user_conf.d frontend: - image: registry.flokaiser.com/dhbw/cloud-computing-frontend:latest + image: git.flokaiser.com/dhbw/cloud-computing-frontend:latest restart: unless-stopped backend: - image: registry.flokaiser.com/dhbw/cloud-computing-backend:latest + image: git.flokaiser.com/dhbw/cloud-computing-backend:latest restart: unless-stopped environment: - DATABASE_URL=${DATABASE_URL}