chore: fix dockerfile and update ci/cd piplines
Some checks failed
Backend ci / build (push) Failing after 1m29s
Some checks failed
Backend ci / build (push) Failing after 1m29s
This commit is contained in:
67
.gitea/workflows/cd-front.yml
Normal file
67
.gitea/workflows/cd-front.yml
Normal file
@@ -0,0 +1,67 @@
|
|||||||
|
name: Deploy frontend
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
|
||||||
|
defaults:
|
||||||
|
run:
|
||||||
|
working-directory: frontend
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
deploy-frontend:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Import Secrets
|
||||||
|
id: import-secrets
|
||||||
|
uses: hashicorp/vault-action@v3.4.0
|
||||||
|
with:
|
||||||
|
url: https://vault.d3m0k1d.ru
|
||||||
|
token: ${{ secrets.VAULT }}
|
||||||
|
secrets: |
|
||||||
|
secret/data/prod/gitea TOKEN | TOKEN ;
|
||||||
|
secret/data/prod/server SSH_KEY | SSH_KEY ;
|
||||||
|
secret/data/prod/server USER | USER ;
|
||||||
|
secret/data/prod/server HOST | HOST ;
|
||||||
|
secret/data/prod/server PORT | PORT
|
||||||
|
|
||||||
|
- name: Login to registry
|
||||||
|
uses: docker/login-action@v3
|
||||||
|
with:
|
||||||
|
registry: gitea.d3m0k1d.ru
|
||||||
|
username: d3m0k1d
|
||||||
|
password: ${{ steps.import-secrets.outputs.TOKEN }}
|
||||||
|
|
||||||
|
- name: Download QEMU
|
||||||
|
uses: docker/setup-qemu-action@v3
|
||||||
|
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v3
|
||||||
|
|
||||||
|
- name: Build and push
|
||||||
|
uses: docker/build-push-action@v5
|
||||||
|
with:
|
||||||
|
context: ./frontend
|
||||||
|
file: ./frontend/Dockerfile
|
||||||
|
push: true
|
||||||
|
tags: gitea.d3m0k1d.ru/d3m0k1d/frontend:latest
|
||||||
|
cache-from: type=gha
|
||||||
|
cache-to: type=gha,mode=max
|
||||||
|
|
||||||
|
- name: Deploy at server
|
||||||
|
uses: appleboy/ssh-action@v1.2.0
|
||||||
|
with:
|
||||||
|
host: ${{ steps.import-secrets.outputs.HOST }}
|
||||||
|
port: ${{ steps.import-secrets.outputs.PORT }}
|
||||||
|
username: ${{ steps.import-secrets.outputs.USER }}
|
||||||
|
key: ${{ steps.import-secrets.outputs.SSH_KEY }}
|
||||||
|
script: |
|
||||||
|
docker login -u d3m0k1d -p ${{ steps.import-secrets.outputs.TOKEN }} gitea.d3m0k1d.ru
|
||||||
|
docker pull gitea.d3m0k1d.ru/d3m0k1d/frontend:latest
|
||||||
|
docker rm -f d3m0k1d-frontend || true
|
||||||
|
docker run --name d3m0k1d-frontend -d -p 80:80 --restart unless-stopped gitea.d3m0k1d.ru/d3m0k1d/frontend:latest
|
||||||
|
|
||||||
@@ -1,40 +0,0 @@
|
|||||||
name: Deploy
|
|
||||||
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- master
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
deploy-frontend:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Login to registry
|
|
||||||
uses: docker/login-action@v3
|
|
||||||
with:
|
|
||||||
registry: gitea.d3m0k1d.ru
|
|
||||||
username: d3m0k1d
|
|
||||||
password: ${{ secrets.TOKEN }}
|
|
||||||
|
|
||||||
- name: Download QEMU
|
|
||||||
uses: docker/setup-qemu-action@v3
|
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
|
||||||
uses: docker/setup-buildx-action@v3
|
|
||||||
|
|
||||||
- name: Build and push
|
|
||||||
uses: docker/build-push-action@v5
|
|
||||||
with:
|
|
||||||
context: ./frontend
|
|
||||||
file: ./frontend/Dockerfile
|
|
||||||
push: true
|
|
||||||
tags: gitea.d3m0k1d.ru/d3m0k1d/frontend:latest
|
|
||||||
- name: Deploy at server
|
|
||||||
uses: appleboy/ssh-action@v1.2.5
|
|
||||||
with:
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
39
.gitea/workflows/ci-back.yml
Normal file
39
.gitea/workflows/ci-back.yml
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
name: Backend ci
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
- develop
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
defaults:
|
||||||
|
run:
|
||||||
|
working-directory: backend
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v6
|
||||||
|
- name: Go setup
|
||||||
|
uses: actions/setup-go@v6
|
||||||
|
with:
|
||||||
|
go-version: '1.25'
|
||||||
|
cache: false
|
||||||
|
- name: Install deps
|
||||||
|
run: go mod tidy
|
||||||
|
- name: Golangci-lint
|
||||||
|
uses: golangci/golangci-lint-action@v9.2.0
|
||||||
|
with:
|
||||||
|
args: --timeout=5m
|
||||||
|
skip-cache: true
|
||||||
|
- name: Run tests
|
||||||
|
run: go test ./...
|
||||||
|
- name: Build
|
||||||
|
run: go build -o backend ./cmd/banforge
|
||||||
@@ -5,7 +5,7 @@ WORKDIR /app
|
|||||||
|
|
||||||
COPY . .
|
COPY . .
|
||||||
ENV CGO_ENABLED=0
|
ENV CGO_ENABLED=0
|
||||||
|
RUN go mod tidy
|
||||||
RUN go build -ldflags "-s -w" -o backend ./cmd/main.go
|
RUN go build -ldflags "-s -w" -o backend ./cmd/main.go
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user