Skip to content

fixed. docker. file. for. the. 20th. time #12

fixed. docker. file. for. the. 20th. time

fixed. docker. file. for. the. 20th. time #12

Workflow file for this run

name: Build and Deploy
on:
push:
branches: ["main"]
env:
REGISTRY: ghcr.io
IMAGE_NAME: "darichardx/educourse"
IS_STATIC_APP: true
jobs:
amd64:
runs-on: ubuntu-22.04
permissions:
contents: read
packages: write
steps:
# Step 1: Checkout repository
- uses: actions/checkout@v3
# Step 2: Set up Node.js environment
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: 18 # Use the Node.js version required by your Next.js app
# Step 3: Install dependencies
- name: Install dependencies
run: npm install
# Cache dependencies
- name: Cache Node.js dependencies
uses: actions/cache@v3
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
# Step 4: Build the Next.js app
- name: Build the Next.js app
run: npm run build
# Step 5: Export the Next.js app (optional for static apps)
#- name: Export static Next.js app
# if: ${{ env.IS_STATIC_APP == 'true' }}
# run: npm run export
# Step 6: Build and push Docker image
- name: Login to ghcr.io
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.TOKEN }}
- name: Cache Docker layers
uses: actions/cache@v3
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-docker-${{ github.sha }}
restore-keys: |
${{ runner.os }}-docker-
- name: Build and push Docker image
uses: docker/build-push-action@v4
with:
context: .
file: Dockerfile
platforms: linux/amd64
push: true
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
# Step 7: Deploy to Coolify
- name: Deploy to Coolify
run: |
curl --request GET '${{ secrets.COOLIFY_WEBHOOK }}' \
--header 'Authorization: Bearer ${{ secrets.COOLIFY_TOKEN }}'