feat: add project id safeguard for event ingestion #14
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build Docker Images | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
build-and-push: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out the private Ops repo | |
uses: actions/checkout@v4 | |
with: | |
token: ${{ secrets.ACCESS_TOKEN }} | |
submodules: "recursive" | |
- name: Generate timestamp | |
id: timestamp | |
run: echo "::set-output name=timestamp::$(date +%Y%m%d%H%M%S)" | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to private Docker Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: registry.lunary.ai | |
username: ${{ secrets.DOCKER_REGISTRY_USERNAME }} | |
password: ${{ secrets.DOCKER_REGISTRY_PASSWORD }} | |
- name: Build and push | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
file: ./ops/backend/Dockerfile | |
push: true | |
tags: | |
registry.lunary.ai/production-backend:${{ steps.timestamp.outputs.timestamp }}-${{ github.sha }}, | |
registry.lunary.ai/production-backend:latest | |
platforms: linux/amd64,linux/arm64 | |
deploy: | |
needs: build-and-push | |
runs-on: ubuntu-latest | |
steps: | |
- name: Deploy to Production | |
uses: appleboy/ssh-action@master | |
with: | |
host: 88.198.48.232 | |
username: root | |
key: ${{ secrets.SSH_PRIVATE_KEY }} | |
port: 3855 | |
script: | | |
cd /opt/lunary | |
docker compose pull | |
docker compose down | |
docker compose up -d |