Skip to content

feat: Add ingest worker, new auth provider and update texts (#35) #196

feat: Add ingest worker, new auth provider and update texts (#35)

feat: Add ingest worker, new auth provider and update texts (#35) #196

Workflow file for this run

name: Build and Deploy
on:
push:
branches:
- main
paths-ignore:
- 'course-work/**'
- 'README.md'
- 'LICENSE.txt'
env:
JOB_STARTED_AT: ${{ github.event.created_at }}
CR_REGISTRY: ${{ secrets.CR_REGISTRY }}
CR_IMAGE_FRONTEND: ${{ secrets.CR_IMAGE_FRONTEND }}
CR_IMAGE_IMAGE_CAPTION: ${{ secrets.CR_IMAGE_IMAGE_CAPTION }}
DOCKER_COMPOSE_FILE_URL: https://raw.githubusercontent.com/finds-su/lost-and-found/main/docker-compose.prod.yml
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Login to Registry
uses: yc-actions/yc-cr-login@v1
with:
yc-sa-json-credentials: ${{ secrets.YC_SA_JSON_CREDENTIALS }}
- name: Build and Push Image
run: |
docker build \
--build-arg NEXT_PUBLIC_CDN_ENDPOINT_URL=https://mn-lost-and-found.storage.yandexcloud.net \
--build-arg NEXT_PUBLIC_S3_UPLOAD_RESOURCE_FORMATS=.png,.jpg,.jpeg,.gif,.webp \
--build-arg NEXT_PUBLIC_NEXTAUTH_URL=https://finds.su \
--pull \
--cache-from cr.yandex/${{ env.CR_REGISTRY }}/${{ env.CR_IMAGE_FRONTEND }}:latest \
--label "org.image.title=${{ github.repository }}" \
--label "org.image.url=${{ github.repositoryUrl }}" \
--label "org.image.created=${{ env.JOB_STARTED_AT }}" \
--label "org.image.revision=${{ github.ref_name }}" \
--label "org.image.version=${{ github.sha }}" \
--tag cr.yandex/${{ env.CR_REGISTRY }}/${{ env.CR_IMAGE_FRONTEND }}:${{ github.sha }} \
.
docker push cr.yandex/${{ env.CR_REGISTRY }}/${{ env.CR_IMAGE_FRONTEND }}:${{ github.sha }}
docker tag cr.yandex/${{ env.CR_REGISTRY }}/${{ env.CR_IMAGE_FRONTEND }}:${{ github.sha }} \
cr.yandex/${{ env.CR_REGISTRY }}/${{ env.CR_IMAGE_FRONTEND }}:latest
docker push cr.yandex/${{ env.CR_REGISTRY }}/${{ env.CR_IMAGE_FRONTEND }}:latest
build-image-caption:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Login to Registry
uses: yc-actions/yc-cr-login@v1
with:
yc-sa-json-credentials: ${{ secrets.YC_SA_JSON_CREDENTIALS }}
- name: Build and Push Image of Image Caption
run: |
cd image-caption
docker build \
--pull \
--cache-from cr.yandex/${{ env.CR_REGISTRY }}/${{ env.CR_IMAGE_IMAGE_CAPTION }}:latest \
--label "org.image.title=${{ github.repository }}" \
--label "org.image.url=${{ github.repositoryUrl }}" \
--label "org.image.created=${{ env.JOB_STARTED_AT }}" \
--label "org.image.revision=${{ github.ref_name }}" \
--label "org.image.version=${{ github.sha }}" \
--tag cr.yandex/${{ env.CR_REGISTRY }}/${{ env.CR_IMAGE_IMAGE_CAPTION }}:${{ github.sha }} \
.
docker push cr.yandex/${{ env.CR_REGISTRY }}/${{ env.CR_IMAGE_IMAGE_CAPTION }}:${{ github.sha }}
docker tag cr.yandex/${{ env.CR_REGISTRY }}/${{ env.CR_IMAGE_IMAGE_CAPTION }}:${{ github.sha }} \
cr.yandex/${{ env.CR_REGISTRY }}/${{ env.CR_IMAGE_IMAGE_CAPTION }}:latest
docker push cr.yandex/${{ env.CR_REGISTRY }}/${{ env.CR_IMAGE_IMAGE_CAPTION }}:latest
deploy:
runs-on: self-hosted
needs: [build, build-image-caption]
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Deploy
run: |
cd ${{ secrets.PRODUCTION_FOLDER }}
curl -O ${{ env.DOCKER_COMPOSE_FILE_URL }}
docker compose -f docker-compose.prod.yml --env-file .env.local pull
docker compose -f docker-compose.prod.yml --env-file .env.local up -d
# nohup docker stack deploy -c<(docker compose -f docker-compose.prod.yml --env-file .env.local up) lost-and-found &