Skip to content

chore: running docker with typescript #2

chore: running docker with typescript

chore: running docker with typescript #2

Workflow file for this run

name: CI/CD
on:
workflow_dispatch:
push:
branches:
- master
- development
paths:
- "src/**"
- "Dockerfile"
pull_request:
branches:
- master
- development
paths:
- "src/**"
- "Dockerfile"
env:
BRANCH_NAME: ${{ github.ref_name }}
APP_NAME: waifuland_api
APP_VERSION: latest
jobs:
gitleaks:
uses: jd-apprentice/jd-workflows/.github/workflows/gitleaks.yml@main
with:
runs-on: ubuntu-latest
name: Gitleaks
secrets:
gh_token: ${{ secrets.GITHUB_TOKEN }}
test:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v2
with:
bun-version: latest
## TODO: Add envs for cloudinary
- name: install dependencies and test
run: |
touch .env
echo DB_HOST="${{ secrets.DB_HOST }}" >> .env
echo PORT=3000 >> .env
echo NODE_ENV=TEST >> .env
echo ROLLBAR_TOKEN="${{ secrets.ROLLBAR_TOKEN }}" >> .env
echo ROLLBAR_ENVIRONMENT=development >> .env
echo TOKEN="${{ secrets.TOKEN }}" >> .env
bun install
bun test
codacy:
if: ${{ github.event_name == 'pull_request' }}
uses: jd-apprentice/jd-workflows/.github/workflows/codacy.yml@main
needs: [gitleaks, test]
with:
name: Codacy
secrets:
project_token: ${{ secrets.CODACY_PROJECT_TOKEN }}
build:
runs-on: ubuntu-22.04
needs: [gitleaks, test]
if: ${{ github.ref_name == 'master' }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Build and push
uses: docker/build-push-action@v4
with:
context: .
file: docker/Dockerfile
push: true
tags: ${{ secrets.DOCKERHUB_USERNAME }}/${{ env.APP_NAME }}:${{ env.APP_VERSION }}
platforms: linux/amd64,linux/arm64