diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml index 8fbff0c..1643ed9 100644 --- a/.gitea/workflows/deploy.yml +++ b/.gitea/workflows/deploy.yml @@ -1,3 +1,4 @@ +```yaml name: Build and Deploy on: @@ -8,8 +9,6 @@ on: jobs: test-backend: runs-on: ubuntu-latest - container: - image: golang:1.25-alpine3.21 steps: - name: Checkout @@ -17,14 +16,14 @@ jobs: - name: Test backend run: | - cd kotosoft-id-backend - go mod tidy - go test ./... + docker run --rm \ + -v "$PWD/kotosoft-id-backend:/app" \ + -w /app \ + golang:1.25-alpine3.21 \ + sh -c 'go mod tidy && go test ./...' lint-frontend: runs-on: ubuntu-latest - container: - image: node:20-alpine steps: - name: Checkout @@ -32,9 +31,11 @@ jobs: - name: Lint frontend run: | - cd kotosoft-id-frontend - npm install - npm run lint + docker run --rm \ + -v "$PWD/kotosoft-id-frontend:/app" \ + -w /app \ + node:20-alpine \ + sh -c 'npm install && npm run lint' build-backend: runs-on: ubuntu-latest @@ -43,13 +44,15 @@ jobs: - name: Checkout uses: actions/checkout@v4 - - name: Build and push backend + - name: Build backend run: | docker build \ -t 172.17.0.1:5000/kotosoft_id_backend:latest \ -f kotosoft-id-backend/Dockerfile \ kotosoft-id-backend + - name: Push backend + run: | docker push 172.17.0.1:5000/kotosoft_id_backend:latest build-frontend: @@ -59,18 +62,26 @@ jobs: - name: Checkout uses: actions/checkout@v4 - - name: Build and push frontend + - name: Build frontend run: | docker build \ -t 172.17.0.1:5000/kotosoft_id_frontend:latest \ -f kotosoft-id-frontend/Dockerfile \ kotosoft-id-frontend + - name: Push frontend + run: | docker push 172.17.0.1:5000/kotosoft_id_frontend:latest deploy: runs-on: ubuntu-latest + needs: + - test-backend + - lint-frontend + - build-backend + - build-frontend + env: FRONTEND_URL: ${{ secrets.FRONTEND_URL }} BACKEND_URL: ${{ secrets.BACKEND_URL }} @@ -93,7 +104,9 @@ jobs: run: | mkdir -p /opt/app cp docker-compose.yml /opt/app/docker-compose.yml + cd /opt/app docker compose -p kotosoft pull - docker compose -p kotosoft up -d --remove-orphans \ No newline at end of file + docker compose -p kotosoft up -d --remove-orphans +```