Merge pull request #111 from Friedrich482/features #33
This file contains hidden or 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: MoonCode CI/CD Pipeline - Build api docker image and deploy to production | |
| on: | |
| push: | |
| branches: "main" | |
| jobs: | |
| build-and-push-docker-image: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v3 | |
| - name: Setup nodejs | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: 24 | |
| cache: npm | |
| - name: Install dependencies | |
| run: npm install | |
| - name: Lint project | |
| run: npm run lint | |
| - name: Log in to Docker Hub | |
| uses: docker/login-action@v3 | |
| with: | |
| username: ${{ secrets.DOCKERHUB_USERNAME }} | |
| password: ${{ secrets.DOCKERHUB_TOKEN }} | |
| - name: Build and push Docker images | |
| run: | | |
| IMAGE_TAG=${{ github.sha }} | |
| docker buildx build --platform linux/amd64 -t ${{ secrets.DOCKERHUB_USERNAME }}/mooncode-api:$IMAGE_TAG -t ${{ secrets.DOCKERHUB_USERNAME }}/mooncode-api:latest --push -f apps/api/Dockerfile . |