This commit is contained in:
parent
eb911056ba
commit
25dca8a869
80
.gitea/workflows/build.yaml
Normal file
80
.gitea/workflows/build.yaml
Normal file
@ -0,0 +1,80 @@
|
|||||||
|
name: Build & Publish Backend
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
paths:
|
||||||
|
- "backend/**"
|
||||||
|
- "frontend/**"
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Check out the repo
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Check changed directories
|
||||||
|
uses: https://github.com/dorny/paths-filter@v2
|
||||||
|
id: changes
|
||||||
|
with:
|
||||||
|
filters: |
|
||||||
|
backend:
|
||||||
|
- 'backend/**'
|
||||||
|
frontend:
|
||||||
|
- 'frontend/**'
|
||||||
|
|
||||||
|
# Frontend
|
||||||
|
- name: "[Frontend] Docker meta"
|
||||||
|
if: steps.changes.outputs.frontend == 'true'
|
||||||
|
id: frontend-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}}
|
||||||
|
|
||||||
|
# Backend
|
||||||
|
- name: "[Backend] Docker meta"
|
||||||
|
if: steps.changes.outputs.backend == 'true'
|
||||||
|
id: backend-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
|
||||||
|
|
||||||
|
# Frontend
|
||||||
|
- name: "[Frontend] Build and push"
|
||||||
|
if: steps.changes.outputs.frontend == 'true'
|
||||||
|
uses: docker/build-push-action@v4
|
||||||
|
with:
|
||||||
|
file: frontend/Dockerfile
|
||||||
|
platforms: linux/amd64
|
||||||
|
push: true
|
||||||
|
tags: ${{ steps.frontend-meta.outputs.tags }}
|
||||||
|
|
||||||
|
# Backend
|
||||||
|
- name: "[Backend] Build and push"
|
||||||
|
if: steps.changes.outputs.backend == 'true'
|
||||||
|
uses: docker/build-push-action@v4
|
||||||
|
with:
|
||||||
|
file: backend/Dockerfile
|
||||||
|
platforms: linux/amd64
|
||||||
|
push: true
|
||||||
|
tags: ${{ steps.backend-meta.outputs.tags }}
|
@ -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
|
|
@ -14,11 +14,11 @@ services:
|
|||||||
- ./proxy:/etc/nginx/user_conf.d
|
- ./proxy:/etc/nginx/user_conf.d
|
||||||
|
|
||||||
frontend:
|
frontend:
|
||||||
image: registry.flokaiser.com/dhbw/cloud-computing-frontend:latest
|
image: git.flokaiser.com/dhbw/cloud-computing-frontend:latest
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
|
|
||||||
backend:
|
backend:
|
||||||
image: registry.flokaiser.com/dhbw/cloud-computing-backend:latest
|
image: git.flokaiser.com/dhbw/cloud-computing-backend:latest
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
environment:
|
environment:
|
||||||
- DATABASE_URL=${DATABASE_URL}
|
- DATABASE_URL=${DATABASE_URL}
|
||||||
|
Loading…
Reference in New Issue
Block a user