Skip to content

Update Dockerfile

Update Dockerfile #18

Workflow file for this run

name: build-push-deploy
on:
push:
branches:
- main
jobs:
build-and-push:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Build Docker image
run: docker buildx build \
--build-arg JWT_SECRET=${{ secrets.JWT_SECRET }} \
--build-arg MONGO_URI=${{ secrets.MONGO_URI }} \
--build-arg PORT=${{ vars.PORT }} \
-t kingitsolutionsteam/nawwa-test:${{ github.sha }} .
- name: Log in to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Push Docker image to Docker Hub
run: docker push kingitsolutionsteam/nawwa-test:${{ github.sha }}
deploy:
runs-on: nawwa-runner
needs: build-and-push
steps:
- name: Log in to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Pull Docker image
run: sudo docker pull kingitsolutionsteam/nawwa-test:${{ github.sha }}
- name: Deploy Docker image
run: sudo docker run -d -p ${{ vars.PORT }}:9005 kingitsolutionsteam/nawwa-test:${{ github.sha }}