Skip to content

CHANGE: Revert api docker. #61

CHANGE: Revert api docker.

CHANGE: Revert api docker. #61

Workflow file for this run

name: Build and Deploy Docker Image
on:
push:
branches: ['master']
pull_request:
branches: ['master']
jobs:
# test:
# timeout-minutes: 10
# runs-on: ubuntu-latest
# env:
# VITE_API_PORT: 3000
# VITE_API_URL: '127.0.0.1'
# VITE_API_REF_URL: '127.0.0.1'
# VITE_FULL_API_URL: ''
# NODE_ENV: 'development'
# steps:
# - uses: actions/checkout@v3
# - uses: oven-sh/setup-bun@v1
# - name: Install dependencies
# run: bun install
# - name: Install Playwright Browsers
# run: bunx playwright install --with-deps
# - name: Run Playwright tests
# run: bunx playwright test
# - uses: actions/upload-artifact@v3
# if: always()
# with:
# name: playwright-report
# path: playwright-report/
# retention-days: 30
build_and_deploy:
runs-on: ubuntu-latest
# TODO: ADD BACK
# needs: [test]
# only build/deploy master branch on pushes
if: ${{ github.ref == 'refs/heads/master' && github.event_name == 'push' }}
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Preset API Image Name
run: echo "IMAGE_API_URL=$(echo ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}:$(echo ${{ github.sha }} | cut -c1-7) | tr '[:upper:]' '[:lower:]')_API" >> $GITHUB_ENV
- name: Preset WEB Image Name
run: echo "IMAGE_WEB_URL=$(echo ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}:$(echo ${{ github.sha }} | cut -c1-7) | tr '[:upper:]' '[:lower:]')_WEB" >> $GITHUB_ENV
- name: Build and push Docker Image for API
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile.api
push: true
tags: ${{ env.IMAGE_API_URL }}
- name: Build and push Docker Image for WEB
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile.web
push: true
tags: ${{ env.IMAGE_WEB_URL }}
- name: Deploy Image to CapRrover
uses: caprover/[email protected]
with:
server: '${{ secrets.CAPROVER_SERVER }}'
app: '${{ secrets.API_APP_NAME }}'
token: '${{ secrets.API_APP_TOKEN }}'
image: ${{ env.IMAGE_API_URL }}
- name: Deploy Image to CapRrover
uses: caprover/[email protected]
with:
server: '${{ secrets.CAPROVER_SERVER }}'
app: '${{ secrets.WEB_APP_NAME }}'
token: '${{ secrets.WEB_APP_TOKEN }}'
image: ${{ env.IMAGE_WEB_URL }}