Add vite config in docker build #12
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: Web CI/CD Pipeline | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
lint: | |
name: Lint Code | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v3 | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '20' | |
- name: Install Dependencies | |
run: npm install | |
- name: Run Prettier Check | |
run: npx prettier --check . | |
- name: Run ESLint | |
run: npx eslint . | |
build: | |
name: Build Application | |
runs-on: ubuntu-latest | |
needs: lint | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v3 | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '20' | |
- name: Install Dependencies | |
run: npm install | |
- name: Build the App | |
run: npm run build | |
- name: Upload Build Artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: build | |
path: build | |
docker: | |
name: Build and Push Docker Image | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v3 | |
- name: Download Build Artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
name: build | |
path: ./build | |
- name: Login to Docker Hub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Build Docker Image | |
run: docker build -f Dockerfile -t ${{ secrets.DOCKER_USERNAME }}/tfremont:latest . | |
- name: Push Docker Image | |
run: docker push ${{ secrets.DOCKER_USERNAME }}/tfremont:latest | |
- name: Install Playwright Browsers | |
run: npx playwright install | |
- name: Run Playwright Tests | |
run: npx playwright test | |
deploy: | |
name: Deploy to k3s | |
runs-on: ubuntu-latest | |
needs: docker | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v3 | |
- name: Set up kubectl | |
uses: azure/setup-kubectl@v3 | |
with: | |
version: 'latest' | |
- name: Configure kubeconfig | |
run: | | |
mkdir -p $HOME/.kube | |
echo "${{ secrets.KUBECONFIG }}" > $HOME/.kube/config |