diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml new file mode 100644 index 0000000..5d17c60 --- /dev/null +++ b/.gitea/workflows/deploy.yml @@ -0,0 +1,24 @@ +name: Deploy +run-name: ${{ gitea.actor }} build image and push to container registry + +on: + push: + branches: + - 'main' + - 'staging' + +jobs: + CreateImage: + runs-on: [hubstaging] + uses: http://gitea.pena/PenaDevops/actions.git/.gitea/workflows/build-image.yml@v1.1.6-p + with: + runner: hubstaging + secrets: + REGISTRY_USER: ${{ secrets.REGISTRY_USER }} + REGISTRY_PASSWORD: ${{ secrets.REGISTRY_PASSWORD }} + DeployService: + runs-on: [hubstaging] + needs: CreateImage + uses: http://gitea.pena/PenaDevops/actions.git/.gitea/workflows/deploy.yml@v1.1.4-p7 + with: + runner: hubstaging diff --git a/.gitea/workflows/lint.yml b/.gitea/workflows/lint.yml new file mode 100644 index 0000000..0bd7867 --- /dev/null +++ b/.gitea/workflows/lint.yml @@ -0,0 +1,14 @@ +name: Lint +run-name: ${{ gitea.actor }} produce linting + +on: + push: + branches: + - 'dev' + +jobs: + Lint: + runs-on: [hubstaging] + uses: http://gitea.pena/PenaDevops/actions.git/.gitea/workflows/lint.yml@v1.1.2 + with: + runner: hubstaging diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml deleted file mode 100644 index bf65bf3..0000000 --- a/.gitlab-ci.yml +++ /dev/null @@ -1,31 +0,0 @@ -include: - - project: "devops/pena-continuous-integration" - file: "/templates/docker/build-template.gitlab-ci.yml" - - project: "devops/pena-continuous-integration" - file: "/templates/docker/deploy-template.gitlab-ci.yml" - -stages: - - build - - deploy - -build-app: - stage: build - extends: .build_template - rules: - - if: $CI_COMMIT_BRANCH == $PRODUCTION_BRANCH || $CI_COMMIT_BRANCH == $STAGING_BRANCH - -deploy-to-staging: - stage: deploy - tags: - - staging - extends: .deploy_template - rules: - - if: "$CI_COMMIT_BRANCH == $STAGING_BRANCH" - -deploy-to-prod: - stage: deploy - tags: - - prod - extends: .deploy_template - rules: - - if: "$CI_COMMIT_BRANCH == $PRODUCTION_BRANCH" diff --git a/Dockerfile b/Dockerfile index 2c0416d..e5a4253 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ # BUILD -FROM golang:1.20.3-alpine AS build +FROM gitea.pena/penadevops/container-images/golang:main as build # Update depences RUN apk update && apk add --no-cache curl @@ -17,7 +17,7 @@ ADD . /app RUN GOOS=linux go build -o bin ./... # PRODUCTION -FROM alpine:latest AS production +FROM gitea.pena/penadevops/container-images/alpine:main # Install packages RUN apk --no-cache add ca-certificates diff --git a/deployments/staging/docker-compose.yaml b/deployments/staging/docker-compose.yaml index 1902462..39f2c64 100644 --- a/deployments/staging/docker-compose.yaml +++ b/deployments/staging/docker-compose.yaml @@ -2,9 +2,7 @@ version: "3.3" services: treasurer-app-staging: - hostname: treasurer-service-staging - container_name: treasurer-service-staging - image: $CI_REGISTRY_IMAGE/staging:$CI_COMMIT_REF_SLUG.$CI_PIPELINE_ID + image: gitea.pena:3000/penaside/treasurer/staging:$GITHUB_RUN_NUMBER tty: true environment: - HTTP_HOST=0.0.0.0 @@ -22,21 +20,13 @@ services: - YOOMONEY_WEBHOOKS_URL=http://treasurer-mock-staging:8080/webhooks - YOOMONEY_PAYMENTS_URL=https://api.yookassa.ru/v3/payments - - MONGO_HOST=10.8.0.6 + - MONGO_HOST=10.7.0.6 - MONGO_PORT=27017 - - MONGO_USER=$MONGO_USER - - MONGO_PASSWORD=$MONGO_PASSWORD + - MONGO_USER=treasurer + - MONGO_PASSWORD=Wr5uCLwIu7CEeWT3 - MONGO_DB_NAME=treasurer - MONGO_AUTH=treasurer ports: - - 10.8.0.6:8085:8085 - - 10.8.0.6:9085:9085 - networks: - - backend_external - - default -networks: - backend_external: - driver: bridge - attachable: true - internal: true - + - 10.7.0.6:8085:8085 + - 10.7.0.6:9085:9085 +