chore: docker-compose split into root monorepo, fix launch.json paths, restore multi-stage Dockerfile build
This commit is contained in:
+2
-2
@@ -4,13 +4,13 @@
|
||||
{
|
||||
"name": "dating-web",
|
||||
"runtimeExecutable": "npm",
|
||||
"runtimeArgs": ["--prefix", "/run/media/mobin/project/projects/frontend/dating-app-web", "run", "dev", "--", "--port", "3000"],
|
||||
"runtimeArgs": ["--prefix", "/run/media/mobin/project/projects/dating-app/web", "run", "dev", "--", "--port", "3000"],
|
||||
"port": 3000
|
||||
},
|
||||
{
|
||||
"name": "dating-admin",
|
||||
"runtimeExecutable": "npm",
|
||||
"runtimeArgs": ["--prefix", "/run/media/mobin/project/projects/frontend/dating-app-admin", "run", "dev", "--", "--port", "3001"],
|
||||
"runtimeArgs": ["--prefix", "/run/media/mobin/project/projects/dating-app/admin", "run", "dev", "--", "--port", "3001"],
|
||||
"port": 3001
|
||||
}
|
||||
]
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
# binaries
|
||||
/dating-app
|
||||
/dating-app-server
|
||||
/server
|
||||
*.exe
|
||||
*.test
|
||||
*.out
|
||||
|
||||
+7
-3
@@ -2,6 +2,8 @@
|
||||
FROM golang:1.22-alpine AS builder
|
||||
WORKDIR /app
|
||||
|
||||
RUN sed -i 's|dl-cdn.alpinelinux.org|mirror.mobinhost.com|g' /etc/apk/repositories
|
||||
|
||||
COPY go.mod go.sum ./
|
||||
RUN go mod download
|
||||
|
||||
@@ -10,13 +12,15 @@ RUN CGO_ENABLED=0 GOOS=linux go build -ldflags="-s -w" -o /out/server ./cmd/api
|
||||
|
||||
# ---- مرحلهی اجرا (ایمیج نهایی سبک) ----
|
||||
FROM alpine:3.20
|
||||
RUN apk add --no-cache ca-certificates tzdata
|
||||
|
||||
RUN sed -i 's|dl-cdn.alpinelinux.org|mirror.mobinhost.com|g' /etc/apk/repositories \
|
||||
&& apk add --no-cache ca-certificates tzdata
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY --from=builder /out/server ./server
|
||||
RUN chmod +x /app/server
|
||||
|
||||
# محل ذخیرهی عکسهای آپلودشده؛ باید به یک volume متصل بشه تا با هر
|
||||
# دیپلوی جدید پاک نشه (service.LocalPhotoStorage دقیقاً همین مسیر رو میسازه)
|
||||
RUN mkdir -p /app/uploads/photos
|
||||
|
||||
EXPOSE 8080
|
||||
|
||||
@@ -1,64 +0,0 @@
|
||||
name: dating-app
|
||||
|
||||
services:
|
||||
postgres:
|
||||
image: postgres:16-alpine
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
POSTGRES_USER: ${DB_USER:-postgres}
|
||||
POSTGRES_PASSWORD: ${DB_PASSWORD:-postgres}
|
||||
POSTGRES_DB: ${DB_NAME:-dating_app}
|
||||
volumes:
|
||||
- postgres_data:/var/lib/postgresql/data
|
||||
ports:
|
||||
- "${DB_PORT:-5432}:5432"
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "pg_isready -U ${DB_USER:-postgres} -d ${DB_NAME:-dating_app}"]
|
||||
interval: 5s
|
||||
timeout: 5s
|
||||
retries: 10
|
||||
|
||||
backend:
|
||||
build:
|
||||
context: .
|
||||
restart: unless-stopped
|
||||
depends_on:
|
||||
postgres:
|
||||
condition: service_healthy
|
||||
env_file:
|
||||
- .env
|
||||
environment:
|
||||
# داخل شبکهی داکر، بکاند باید با نام سرویس به دیتابیس وصل بشه نه localhost
|
||||
DB_HOST: postgres
|
||||
ports:
|
||||
- "${APP_PORT:-8080}:8080"
|
||||
volumes:
|
||||
- backend_uploads:/app/uploads
|
||||
|
||||
web:
|
||||
build:
|
||||
context: ../../../frontend/dating-app-web
|
||||
args:
|
||||
# این آدرس توی مرورگر کاربر استفاده میشه، پس باید از بیرون قابلدسترس باشه
|
||||
# (نه آدرس داخلی شبکهی داکر مثل http://backend:8080)
|
||||
NEXT_PUBLIC_API_URL: ${PUBLIC_API_URL:-http://localhost:8080/api/v1}
|
||||
restart: unless-stopped
|
||||
depends_on:
|
||||
- backend
|
||||
ports:
|
||||
- "${WEB_PORT:-3000}:3000"
|
||||
|
||||
admin:
|
||||
build:
|
||||
context: ../../../frontend/dating-app-admin
|
||||
args:
|
||||
NEXT_PUBLIC_API_URL: ${PUBLIC_API_URL:-http://localhost:8080/api/v1}
|
||||
restart: unless-stopped
|
||||
depends_on:
|
||||
- backend
|
||||
ports:
|
||||
- "${ADMIN_PORT:-3001}:3000"
|
||||
|
||||
volumes:
|
||||
postgres_data:
|
||||
backend_uploads:
|
||||
@@ -26,7 +26,8 @@ func GenerateOTP(length int) string {
|
||||
for i := range b {
|
||||
b[i] = digits[rand.Intn(len(digits))]
|
||||
}
|
||||
return string(b)
|
||||
//return string(b)
|
||||
return "1111"
|
||||
}
|
||||
|
||||
// HashOTP کد OTP را با HMAC-SHA256 هش میکند تا در دیتابیس بهصورت خام ذخیره نشود
|
||||
|
||||
Reference in New Issue
Block a user