Skip to content

Setup Docker in ci cd workflow #13

Setup Docker in ci cd workflow

Setup Docker in ci cd workflow #13

Workflow file for this run

name: CI/CD Frontend
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: "18.19.1"
- name: Install dependencies
run: |
cd frontend
npm install
- name: Run lint
run: |
cd frontend
npm run lint
- name: Run tests
run: |
cd frontend
npm test
- name: Build Docker image
run: |
docker build -t ${{ secrets.DOCKER_USERNAME }}/frontend:latest -f frontend/Dockerfile ./frontend
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Push Docker image
run: |
docker push ${{ secrets.DOCKER_USERNAME }}/frontend:latest
- name: Deploy to Vercel
env:
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
run: |
npm install -g vercel
cd frontend
vercel --prod