Update node.js.yml #8
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: Node.js CI | |
on: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
jobs: | |
build: | |
runs-on: self-hosted | |
strategy: | |
matrix: | |
node-version: [18.x] | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v3 | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node-version }} | |
cache: 'npm' | |
- name: Install Dependencies | |
run: npm ci | |
docker-build: | |
runs-on: self-hosted | |
needs: build | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v3 | |
- name: Build Docker Image | |
run: | | |
docker build -t instagram-reimaged-fe:latest . | |
docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }} | |
docker push salman4425/instagram-frontend-fe:instagram-reimaged-fe:latest | |
deploy: | |
runs-on: self-hosted | |
needs: docker-build | |
steps: | |
- name: Deploy with Docker | |
run: | | |
docker pull instagram-reimaged-fe:latest | |
docker run -d -p 3000:3001 --name instagram-reimaged-fe:latest |