ci/cd: configure automated Docker builds on Gitea and Portainer deployment
Build and Deploy / build-and-push (push) Successful in 2m39s
Build and Deploy / build-and-push (push) Successful in 2m39s
This commit is contained in:
1 parent
7a84480d70
commit
eb29528aad
11 files changed
+82
-25
No files matched your search
@@ -1,3 +1,4 @@
|
||||
NEXT_PUBLIC_SUPABASE_URL=YOUR_PUBLIC_SUPABASE_URL
|
||||
NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY=YOUR_PUBLIC_SUPABASE_PUBLISHABLE_KEY
|
||||
BASE_PATH=""
|
||||
PORT=3000
|
||||
@@ -0,0 +1,34 @@
|
||||
name: Build and Deploy
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
|
||||
jobs:
|
||||
build-and-push:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout Code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Log in to Gitea Container Registry
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: gitea.pascalyazid.com
|
||||
username: ${{ secrets.REGISTRY_USERNAME }}
|
||||
password: ${{ secrets.REGISTRY_TOKEN }}
|
||||
|
||||
- name: Build and Push Docker Image
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
context: .
|
||||
platforms: linux/arm64,linux/amd64
|
||||
push: true
|
||||
tags: gitea.pascalyazid.com/pascalyazid/fastchat:latest
|
||||
build-args: |
|
||||
NEXT_PUBLIC_SUPABASE_URL=${{ secrets.NEXT_PUBLIC_SUPABASE_URL }}
|
||||
NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY=${{ secrets.NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY }}
|
||||
@@ -18,6 +18,9 @@
|
||||
/out/
|
||||
|
||||
# production
|
||||
.env.production
|
||||
.env.development
|
||||
.env
|
||||
/build
|
||||
|
||||
# misc
|
||||
|
||||
+10
-1
@@ -11,6 +11,15 @@ FROM base AS builder
|
||||
WORKDIR /app
|
||||
COPY --from=deps /app/node_modules ./node_modules
|
||||
COPY . .
|
||||
|
||||
# --- MUST BE HERE IN THE BUILDER STAGE ---
|
||||
ARG NEXT_PUBLIC_SUPABASE_URL
|
||||
ARG NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY
|
||||
|
||||
ENV NEXT_PUBLIC_SUPABASE_URL=$NEXT_PUBLIC_SUPABASE_URL
|
||||
ENV NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY=$NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY
|
||||
# -----------------------------------------
|
||||
|
||||
RUN bun run build
|
||||
|
||||
# Step 3. Production image
|
||||
@@ -24,4 +33,4 @@ COPY --from=builder /app/.next/static ./.next/static
|
||||
|
||||
EXPOSE 3000
|
||||
ENV PORT=3000
|
||||
CMD ["bun", "server.js"]
|
||||
CMD ["bun", "server.js"]
|
||||
@@ -51,6 +51,7 @@ export function AvatarUpload({ avatarUrl }: Readonly<{ avatarUrl: string | null
|
||||
<Image
|
||||
src={avatarUrl}
|
||||
alt=""
|
||||
loading="eager"
|
||||
width={200}
|
||||
height={200}
|
||||
className="size-20 rounded-full border-4 border-white object-cover shadow-md transition group-hover:opacity-80"
|
||||
|
||||
+12
-12
@@ -1,13 +1,13 @@
|
||||
services:
|
||||
web:
|
||||
build: .
|
||||
image: fastchat:latest
|
||||
container_name: fastchat
|
||||
pull_policy: build
|
||||
restart: always
|
||||
ports:
|
||||
- "${PORT}:3000"
|
||||
environment:
|
||||
- NEXT_PUBLIC_SUPABASE_URL
|
||||
- NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY
|
||||
- BASE_PATH
|
||||
web:
|
||||
build:
|
||||
context: .
|
||||
args:
|
||||
NEXT_PUBLIC_SUPABASE_URL: ${NEXT_PUBLIC_SUPABASE_URL}
|
||||
NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY: ${NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY}
|
||||
ports:
|
||||
- "${PORT:-3000}:3000"
|
||||
environment:
|
||||
- NEXT_PUBLIC_SUPABASE_URL
|
||||
- NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY
|
||||
- BASE_PATH
|
||||
+16
-8
@@ -1,16 +1,24 @@
|
||||
import type { NextConfig } from "next";
|
||||
import type { NextConfig } from 'next';
|
||||
|
||||
const getHostname = (urlStr: string | undefined): string | null => {
|
||||
if (!urlStr || urlStr.trim() === '') return null;
|
||||
try {
|
||||
return new URL(urlStr).hostname;
|
||||
} catch {
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
||||
const supabaseHostname = getHostname(process.env.NEXT_PUBLIC_SUPABASE_URL);
|
||||
|
||||
const nextConfig: NextConfig = {
|
||||
output: "standalone",
|
||||
basePath: process.env.BASE_PATH,
|
||||
allowedDevOrigins: ["100.64.0.10"],
|
||||
output: 'standalone',
|
||||
images: {
|
||||
remotePatterns: [
|
||||
{
|
||||
protocol: "https",
|
||||
hostname: "supabase.pascalyazid.com",
|
||||
port: "",
|
||||
pathname: "/storage/v1/object/sign/avatars/**",
|
||||
protocol: 'https',
|
||||
hostname: supabaseHostname ?? '**.supabase.co',
|
||||
pathname: '/storage/v1/object/**',
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
@@ -75,7 +75,7 @@ export async function listRooms() {
|
||||
|
||||
const { data: rooms, error: roomsError } = await supabase
|
||||
.from("rooms")
|
||||
.select("id, name, created_at")
|
||||
.select("id, name, created_at, owner_id")
|
||||
.in("id", roomIds)
|
||||
.order("created_at", { ascending: false });
|
||||
|
||||
@@ -98,6 +98,7 @@ export async function listRooms() {
|
||||
id: room.id,
|
||||
name: room.name,
|
||||
created_at: room.created_at,
|
||||
owner_id: room.owner_id,
|
||||
member_count: countMap.get(room.id) ?? 0,
|
||||
}));
|
||||
}
|
||||
|
||||
@@ -3,6 +3,6 @@ import { createBrowserClient } from "@supabase/ssr";
|
||||
export function createClient() {
|
||||
return createBrowserClient(
|
||||
process.env.NEXT_PUBLIC_SUPABASE_URL!,
|
||||
process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY!,
|
||||
process.env.NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY!,
|
||||
);
|
||||
}
|
||||
@@ -8,7 +8,7 @@ export async function updateSession(request: NextRequest) {
|
||||
|
||||
const supabase = createServerClient(
|
||||
process.env.NEXT_PUBLIC_SUPABASE_URL!,
|
||||
process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY!,
|
||||
process.env.NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY!,
|
||||
{
|
||||
cookies: {
|
||||
getAll() {
|
||||
|
||||
@@ -6,7 +6,7 @@ export async function createClient() {
|
||||
|
||||
return createServerClient(
|
||||
process.env.NEXT_PUBLIC_SUPABASE_URL!,
|
||||
process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY!,
|
||||
process.env.NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY!,
|
||||
{
|
||||
cookies: {
|
||||
getAll() {
|
||||
|
||||
Reference in new issue
Block a user