Skip to content
This repository was archived by the owner on Feb 11, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
node_modules
npm-debug.log
yarn-error.log
package-lock.json
yarn.lock

# Build output
Expand Down
4 changes: 3 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ PUBLIC_URL="http://localhost:4000"
PUBLIC_PORT=4000
ALLOWED_ORIGINS=http://localhost:5173

# Set a strong random value for `SESSION_SECRET` in your local `.env`
SESSION_SECRET=""

# Set a strong random value for `SESSION_SECRET` in your local `.env`
# For MySQL (dev): mysql://user:password@localhost:3306/database
# For Azure MySQL: mysql://user@server:password@server.mysql.database.azure.net:3306/database
DATABASE_URL=""
36 changes: 35 additions & 1 deletion .github/workflows/cicd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ jobs:
run: npm ci

- name: Prisma Generate
env:
DATABASE_URL: ${{ secrets.DATABASE_URL }}
run: npx prisma generate

- name: Run tests
Expand All @@ -48,6 +50,7 @@ jobs:
name: Build & Push Docker Image
runs-on: ubuntu-latest
needs: build_test
if: github.event_name == 'push' && github.ref == 'refs/heads/main'

steps:
- uses: actions/checkout@v3
Expand Down Expand Up @@ -78,10 +81,29 @@ jobs:
name: Prisma Migrate Deploy
runs-on: ubuntu-latest
needs: docker_build_push
if: github.event_name == 'push' && github.ref == 'refs/heads/main'

steps:
- uses: actions/checkout@v3

- name: Azure Login
uses: azure/login@v1
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}

- name: Get Runner IP
id: ip
run: echo "runner_ip=$(curl -s https://api.ipify.org)" >> $GITHUB_OUTPUT

- name: Add Runner IP to MySQL Firewall
run: |
az mysql flexible-server firewall-rule create \
--resource-group ${{ secrets.AZURE_RESOURCE_GROUP }} \
--name ${{ secrets.AZURE_MYSQL_SERVER_NAME }} \
--rule-name "GitHub-Actions-${{ github.run_id }}" \
--start-ip-address ${{ steps.ip.outputs.runner_ip }} \
--end-ip-address ${{ steps.ip.outputs.runner_ip }}

- name: Setup Node.js
uses: actions/setup-node@v3
with:
Expand All @@ -91,17 +113,29 @@ jobs:
run: npm ci

- name: Prisma Generate
env:
DATABASE_URL: ${{ secrets.DATABASE_URL }}
run: npx prisma generate

- name: Prisma Migrate Deploy
env:
DATABASE_URL: ${{ secrets.DATABASE_URL }}
run: npx prisma migrate deploy

- name: Remove Runner IP from MySQL Firewall
if: always()
run: |
az mysql flexible-server firewall-rule delete \
--resource-group ${{ secrets.AZURE_RESOURCE_GROUP }} \
--name ${{ secrets.AZURE_MYSQL_SERVER_NAME }} \
--rule-name "GitHub-Actions-${{ github.run_id }}" \
--yes

deploy:
name: Deploy to Azure Container App
runs-on: ubuntu-latest
needs: prisma_migrate
needs: [docker_build_push, prisma_migrate]
if: github.event_name == 'push' && github.ref == 'refs/heads/main' && needs.docker_build_push.result == 'success'

steps:
- name: Azure Login
Expand Down
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ RUN npm ci
# Copy source files
COPY . .

# Generate Prisma client
# Generate Prisma client (dummy MySQL connection for build)
ENV DATABASE_URL="mysql://user:password@localhost:3306/db"
RUN npm run db:generate

# Build application
Expand Down
Loading