diff --git a/.github/workflow/deploy.yml b/.github/workflow/deploy.yml new file mode 100644 index 0000000..9ae3ae4 --- /dev/null +++ b/.github/workflow/deploy.yml @@ -0,0 +1,41 @@ +on: + push: + branches: + - main # Change this to your default branch if it's differ ent + +jobs: + deploy: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Setup Node.js + uses: actions/setup-node@v2 + with: + node-version: 18 # Use Node.js 18 here + + - name: Install dependencies + run: npm install + + - name: Build site + run: npm run build + + - uses: actions/checkout@v2 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + + - name: Log in to Docker Hub - Main web app container registry + uses: docker/login-action@v1 + with: + username: ${{ secrets.USERNAME }} + password: ${{ secrets.PASSWORD }} + + - name: Build and push Main web app container image to registry + uses: docker/build-push-action@v2 + with: + push: true + tags: ${{ secrets.USERNAME }}/project:latest + file: ./Dockerfile.prod \ No newline at end of file