This commit is contained in:
Lizandro Guarnizo
2026-03-11 11:27:51 -05:00
parent 94d206a469
commit ae5f748357
4 changed files with 69 additions and 7 deletions
+8
View File
@@ -0,0 +1,8 @@
.git
.env
.air.conf
logs/
session.db
node_modules/
*.md
apiv2
+3 -3
View File
@@ -6,9 +6,9 @@ APP_URL=https://admin.u-site.app
DB_DRIVER=postgres
DB_HOST=46.202.93.92
DB_PORT=5432
DB_USER=usite
DB_PASS=P0sTgR3s!S3guro2025*
DB_NAME=usite
DB_USER=postgres
DB_PASS=0HZ3rRdsJ7paBAHEg07jtJU0RDuDKLthfXZnpsJZWD3ocMWzTQKFbPKlJUvFQFEA
DB_NAME=postgres
MAIL_HOST=smtp.hostinger.com
+54
View File
@@ -0,0 +1,54 @@
# ──────────────────────────────────────────
# Stage 1: Build del frontend (assets JS/CSS)
# ──────────────────────────────────────────
FROM node:20-alpine AS frontend
WORKDIR /app
COPY package.json webpack.mix.js postcss.config.js tailwind.config.js ./
RUN npm install --frozen-lockfile
COPY resources/ resources/
COPY public/ public/
RUN npm run production
# ──────────────────────────────────────────
# Stage 2: Build del binario Go
# ──────────────────────────────────────────
FROM golang:1.22-alpine AS builder
WORKDIR /app
# Instalar dependencias del sistema necesarias para CGO (argon2, etc.)
RUN apk add --no-cache gcc musl-dev
COPY go.mod go.sum ./
RUN go mod download
COPY . .
# Copiar assets del frontend compilados
COPY --from=frontend /app/public ./public
RUN CGO_ENABLED=1 GOOS=linux go build -ldflags="-s -w" -o apiv2 .
# ──────────────────────────────────────────
# Stage 3: Imagen final mínima
# ──────────────────────────────────────────
FROM alpine:3.20
WORKDIR /app
# Certificados TLS y timezone
RUN apk add --no-cache ca-certificates tzdata
# Copiar binario compilado
COPY --from=builder /app/apiv2 .
# Copiar archivos estáticos y plantillas
COPY --from=builder /app/public ./public
COPY --from=builder /app/resources/views ./resources/views
COPY --from=builder /app/assets ./assets
# config.yml se monta como volumen o se inyecta vía env en Coolify
COPY config.sample.yml ./config.yml
EXPOSE 8080
ENTRYPOINT ["./apiv2", "-config", "config.yml"]
+4 -4
View File
@@ -9,11 +9,11 @@ database:
port: 3306
postgres: &postgres
driver: postgres
host: localhost
host: 46.202.93.92
username: postgres
password: postgres
password: 0HZ3rRdsJ7paBAHEg07jtJU0RDuDKLthfXZnpsJZWD3ocMWzTQKFbPKlJUvFQFEA
port: 5432
db_name: casbin
db_name: postgres
sqlserver: &sqlserver
driver: sqlserver
host: localhost
@@ -24,7 +24,7 @@ database:
sqlite: &sqlite
driver: sqlite
db_name: "data.db" # Nombre del archivo de la base de datos SQLite
sqlserver: *sqlite # Cambia esto si quieres usar otra base de datos como predeterminada
default: *postgres
server: &server
name: "USITE "