-
-
Notifications
You must be signed in to change notification settings - Fork 822
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
f5a1b96
commit 18ac449
Showing
3 changed files
with
29 additions
and
68 deletions.
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
This file was deleted.
Oops, something went wrong.
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,39 +1,41 @@ | ||
FROM node:18-slim AS base | ||
ENV PNPM_HOME="/pnpm" | ||
ENV PATH="$PNPM_HOME:$PATH" | ||
RUN corepack enable | ||
# Build stage | ||
FROM golang:1.21-alpine3.19 AS builder | ||
|
||
FROM base AS build | ||
COPY . /usr/src/app | ||
WORKDIR /usr/src/app | ||
# Instalar dependencias necesarias | ||
RUN apk add --no-cache gcc musl-dev sqlite-dev | ||
|
||
RUN apt-get update && apt-get install -y python3 make g++ git && rm -rf /var/lib/apt/lists/* | ||
# Establecer el directorio de trabajo | ||
WORKDIR /app | ||
|
||
# Install dependencies | ||
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm --filter=./apps/monitoring install --frozen-lockfile | ||
# Copiar todo el código fuente primero | ||
COPY . . | ||
|
||
# Deploy only the monitoring app | ||
# Movernos al directorio de la aplicación golang | ||
WORKDIR /app/apps/monitoring | ||
|
||
ENV NODE_ENV=production | ||
RUN pnpm --filter=./apps/monitoring run build | ||
# Descargar dependencias | ||
RUN go mod download | ||
|
||
RUN pnpm --filter=./apps/monitoring --prod deploy /prod/monitoring | ||
# Compilar la aplicación | ||
RUN CGO_ENABLED=1 GOOS=linux go build -o main main.go | ||
|
||
RUN cp -R /usr/src/app/apps/monitoring/dist /prod/monitoring/dist | ||
# Etapa final | ||
FROM alpine:3.19 | ||
|
||
FROM base AS dokploy | ||
WORKDIR /app | ||
# Instalar SQLite y otras dependencias necesarias | ||
RUN apk add --no-cache sqlite-libs docker-cli | ||
|
||
# Set production | ||
ENV NODE_ENV=production | ||
WORKDIR /app | ||
|
||
RUN apt-get update && apt-get install -y curl && rm -rf /var/lib/apt/lists/* | ||
# Copiar el binario compilado y el archivo monitor.go | ||
COPY --from=builder /app/apps/monitoring/main ./main | ||
COPY --from=builder /app/apps/monitoring/main.go ./monitor.go | ||
|
||
RUN curl -fsSL https://get.docker.com -o get-docker.sh && sh get-docker.sh && rm get-docker.sh | ||
# COPY --from=builder /app/apps/golang/.env ./.env | ||
|
||
# Copy only the necessary files | ||
COPY --from=build /prod/monitoring/dist ./dist | ||
COPY --from=build /prod/monitoring/package.json ./package.json | ||
COPY --from=build /prod/monitoring/node_modules ./node_modules | ||
# Exponer el puerto | ||
ENV PORT=3001 | ||
EXPOSE 3001 | ||
|
||
CMD HOSTNAME=0.0.0.0 && pnpm start | ||
# Ejecutar la aplicación | ||
CMD ["./main"] |