Skip to content

Rate limits

Rate limits #24

Workflow file for this run

name: Build & Deploy
on:
push:
branches: [ main ]
pull_request:
jobs:
build:
runs-on: ubuntu-latest
permissions:
packages: write
outputs:
image-tag: ${{ steps.tag.outputs.IMAGE_TAG }}
steps:
- name: Check Out Repo
uses: actions/checkout@v4
- name: Login to Github Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: bezysoftware
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v3
- name: Cache Docker layers
uses: actions/cache@v4
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Get docker tag
id: tag
run: |
echo "${GITHUB_REF##*/}"
if [[ "${GITHUB_REF##*/}" == "main" ]]; then
echo "IMAGE_TAG=latest" >> $GITHUB_OUTPUT
else
echo "IMAGE_TAG=${GITHUB_SHA}" >> $GITHUB_OUTPUT
fi
- name: Build and push
id: docker_build
uses: docker/build-push-action@v6
with:
context: ./
file: ./Dockerfile
builder: ${{ steps.buildx.outputs.name }}
push: true
tags: ghcr.io/bezysoftware/netstr:${{ steps.tag.outputs.IMAGE_TAG }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache
deploy:
runs-on: ubuntu-latest
needs: [ build ]
environment: dev
permissions:
packages: read
env:
IMAGE_TAG: ${{ needs.build.outputs.image-tag }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup SSH
uses: shimataro/ssh-key-action@v2
with:
key: ${{ secrets.SSH_PRIVATE_KEY }}
known_hosts: ${{ secrets.SSH_KNOWN_HOSTS }}
- name: Create docker context
run: docker context create remote --docker "host=ssh://${{ secrets.SSH_USER }}@${{ secrets.SSH_REMOTE_HOST }}"
- name: Docker compose up
run: |
docker --context remote compose pull
docker --context remote compose up -d
env:
NETSTR_DB_PASSWORD: ${{ secrets.NETSTR_DB_PASSWORD }}
NETSTR_IMAGE: "ghcr.io/bezysoftware/netstr:${{ env.IMAGE_TAG }}"
NETSTR_ENVIRONMENT: dev
NETSTR_ENVIRONMENT_LONG: Development
NETSTR_PORT: 8081
NETSTR_VERSION: ${{ github.sha }}