Created
July 3, 2025 23:35
-
-
Save k8adev/7f122e4deb83e625698aca45a20a3207 to your computer and use it in GitHub Desktop.
Github Actions for NestJs applications in arm64 architecture using Mau
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: Deploy | |
on: | |
push: | |
branches: | |
- main | |
- preview | |
jobs: | |
deploy: | |
name: Deploy | |
uses: ./.github/workflows/mau.yml | |
with: | |
# It uses the branch name to determine the environment to deploy to. | |
# https://docs.github.com/en/actions/how-tos/managing-workflow-runs-and-deployments/managing-deployments/managing-environments-for-deployment | |
environment: ${{ github.ref_name == 'main' && 'Production' || 'Preview' }} | |
secrets: inherit |
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
FROM node:22.14-bullseye-slim | |
WORKDIR /usr/src/app | |
COPY package*.json ./ | |
RUN apt-get update && apt-get install -y \ | |
curl \ | |
python3 \ | |
make \ | |
g++ \ | |
&& rm -rf /var/lib/apt/lists/* | |
RUN npm install --no-audit | |
COPY . . | |
RUN npm run build | |
EXPOSE 3000 | |
CMD [ "node", "dist/main.js" ] |
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: Mau | |
on: | |
workflow_call: | |
inputs: | |
environment: | |
description: Environment to deploy | |
required: true | |
type: string | |
jobs: | |
deploy: | |
name: ${{ inputs.environment }} | |
environment: ${{ inputs.environment }} | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 22.14 | |
cache: npm | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
with: | |
platforms: arm64 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
with: | |
platforms: linux/arm64 | |
- name: Setup Environment | |
shell: bash | |
run: | | |
if [ "${{ github.event_name }}" == "pull_request" ]; then | |
echo "GIT_HASH=${{ github.event.pull_request.head.sha }}" >> ${GITHUB_ENV} | |
else | |
echo "GIT_HASH=${GITHUB_SHA}" >> ${GITHUB_ENV} | |
fi | |
- name: Deploy | |
run: npx @nestjs/mau deploy --wait-for-service-stability --dockerfile Dockerfile | |
env: | |
MAU_KEY: ${{ secrets.MAU_KEY }} | |
MAU_SECRET: ${{ secrets.MAU_SECRET }} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment