-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8387d0c
commit 792140e
Showing
6 changed files
with
78 additions
and
1 deletion.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
.git | ||
node_modules |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
NEXT_PUBLIC_BASE_URL=http://localhost:3000 | ||
NEXT_PUBLIC_BASE_URL=https://example.com | ||
PORT=3000 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
name: Deploy Project | ||
|
||
on: | ||
push: | ||
branches: | ||
- main # Trigger the workflow on push to main branch | ||
|
||
jobs: | ||
deploy: | ||
runs-on: self-hosted | ||
steps: | ||
# ssh into the server | ||
- name: SSH into server | ||
run: | | ||
ssh -o StrictHostKeyChecking=no root@192.168.100.4 << 'EOF' | ||
cd /root/apps/miit | ||
git restore . | ||
git pull origin main | ||
docker compose down | ||
docker compose up -d --build | ||
EOF |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# Use the official Bun image as the base | ||
FROM oven/bun:1.1.29-alpine | ||
|
||
# Set the working directory | ||
WORKDIR /app | ||
|
||
# add curl | ||
RUN apk update && apk add curl | ||
|
||
# Copy package.json and bun.lockb for faster installs | ||
COPY package.json ./ | ||
COPY bun.lockb ./ | ||
|
||
# Install dependencies | ||
RUN bun install | ||
|
||
# Copy the rest of the application code | ||
COPY . . | ||
|
||
# Build the project | ||
RUN bun run build | ||
|
||
# Start the Next.js server | ||
CMD bun run start |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export async function GET(_: Request) { | ||
return new Response('OK', { status: 200 }) | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
services: | ||
web: | ||
build: . | ||
restart: always | ||
expose: | ||
- ${PORT} | ||
environment: | ||
PORT: ${PORT} | ||
NEXT_PUBLIC_BASE_URL: "https://miit.hawari.dev" | ||
|
||
labels: | ||
- "traefik.enable=true" | ||
- "traefik.http.routers.miit.rule=Host(`miit.hawari.dev`)" | ||
- "traefik.http.routers.miit.entrypoints=web" | ||
- "traefik.http.services.miit.loadbalancer.server.port=${PORT}" | ||
healthcheck: | ||
test: ["CMD-SHELL", "curl http://localhost:${PORT}/api/heartbeat"] | ||
interval: 5s | ||
timeout: 5s | ||
retries: 5 | ||
networks: | ||
- traefik-network | ||
|
||
networks: | ||
traefik-network: | ||
external: true |