Merge pull request #23 from like-minded-nus/staging #3
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: Production CI Pipeline | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
- name: Set up Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20.10.0 | |
- name: Install Dependencies | |
run: npm install | |
- name: Build Next.js App | |
run: npm run build | |
docker: | |
runs-on: ubuntu-latest | |
needs: build | |
name: Build NextJS docker image | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to docker hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Build and Push Docker Image | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
file: ./Dockerfile | |
target: dev | |
platforms: linux/amd64,linux/arm64/v8 | |
push: true | |
tags: ${{ secrets.DOCKER_USERNAME }}/like-minded-fe-prod:latest | |
build-args: | | |
NEXT_PUBLIC_API_ENDPOINT=${{ secrets.NEXT_PUBLIC_API_PROD_ENDPOINT }} | |
NEXT_PUBLIC_WS_ENDPOINT=${{ secrets.NEXT_PUBLIC_WS_PROD_ENDPOINT }} | |
NEXTAUTH_URL=${{ secrets.NEXTAUTH_PROD_URL }} | |
NEXTAUTH_SECRET=${{ secrets.NEXTAUTH_SECRET }} |