Skip to content

πŸ“š The open-source, offline-first Notion, Obsidian & Confluence alternative. Advanced Markdown, multi-tenant teams, OIDC/SSO, and local S3 backups. Deploy in one command.

Fix docker compose, deployment scripts and docker images

Smaug6739fe042315ee74
diff --git a/.github/workflows/deploy_to_prod.yml b/.github/workflows/deploy_to_prod.yml
index 2277f5ab..501c19a2 100755
--- a/.github/workflows/deploy_to_prod.yml
+++ b/.github/workflows/deploy_to_prod.yml
@@ -62,6 +62,7 @@ jobs:
DATABASE_USER=${{ secrets.DATABASE_USER }}
DATABASE_PASSWORD="${{ secrets.DATABASE_PASSWORD }}"
JWT_SECRET=${{ secrets.JWT_SECRET }}
+ BACKEND_PORT=8201
MINIO_ACCESSKEY=${{ secrets.MINIO_ACCESSKEY }}
MINIO_SECRETKEY=${{ secrets.MINIO_SECRETKEY }}
SMTP_HOST=${{ secrets.SMTP_HOST }}
diff --git a/backend/config.toml b/backend/config.toml
index 19121525..a3c3143d 100644
--- a/backend/config.toml
+++ b/backend/config.toml
@@ -1,5 +1,3 @@
-Port = 8201
-
[Database]
Driver = "mysql"
Host = "localhost"
diff --git a/backend/main.go b/backend/main.go
index c5625003..05c93416 100644
--- a/backend/main.go
+++ b/backend/main.go
@@ -3,12 +3,18 @@ package main
import (
"alexandrie/server"
"fmt"
+ "os"
)
func main() {
server, application := server.SetupServer()
- fmt.Println("Starting server on port:", application.Config.Port)
+ port := os.Getenv("BACKEND_PORT")
+ if port == "" {
+ fmt.Fprintln(os.Stderr, "Error: BACKEND_PORT environment variable not set")
+ os.Exit(1)
+ }
+ fmt.Println("Starting server on port:", port)
defer application.DB.Close()
- server.Run(":" + fmt.Sprintf("%d", application.Config.Port))
+ server.Run(":" + fmt.Sprintf("%s", port))
}
diff --git a/docker-compose.yml b/docker-compose.yml
index b19f4958..aeee89d9 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -72,7 +72,7 @@ services:
SMTP_PASSWORD: ''
# Port Configuration
- PORT: 8201
+ BACKEND_PORT: 8201
CPWD: /app/
CONFIG_CPWD: ''
GIN_MODE: release
diff --git a/frontend/Dockerfile b/frontend/Dockerfile
index 7bd4cd55..7bcbe215 100644
--- a/frontend/Dockerfile
+++ b/frontend/Dockerfile
@@ -1,4 +1,6 @@
+# ========================================
# Build stage
+# ========================================
FROM node:22-alpine AS builder
# Install bun
@@ -12,14 +14,16 @@ COPY package.json bun.lock ./
RUN bun install
COPY . .
ENV NODE_ENV=production
-ENV PORT=8200
-ENV VITE_BASE_API="http://localhost:8201"
-ENV VITE_BASE_CDN="http://localhost:9000/alexandrie"
RUN bun run build
+# ========================================
# Runtime stage
+# ========================================
FROM node:22-alpine AS runtime
+
WORKDIR /app
+ENV PORT=${PORT}
+
COPY --from=builder /app/.output /app/.output
COPY docker-entrypoint.sh /app/docker-entrypoint.sh
RUN chmod +x /app/docker-entrypoint.sh
diff --git a/frontend/docker-entrypoint.sh b/frontend/docker-entrypoint.sh
index 20e1881c..6f25b319 100644
--- a/frontend/docker-entrypoint.sh
+++ b/frontend/docker-entrypoint.sh
@@ -1,7 +1,7 @@
#!/bin/sh
echo "Building application with current environment variables..."
-echo "API: $VITE_BASE_API"
-echo "CDN: $VITE_BASE_CDN"
+echo "API: $NUXT_PUBLIC_BASE_API"
+echo "CDN: $NUXT_PUBLIC_BASE_CDN"
echo "URL: $NUXT_PUBLIC_BASE_URL"
echo "Starting Nitro server..."
exec node .output/server/index.mjs
\ No newline at end of file