-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile.production
129 lines (98 loc) · 3.73 KB
/
Dockerfile.production
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
# Fase de construcción
FROM node:20 as build
WORKDIR /app
# Definir vars de entorno
ARG ENVIRONMENT=test2-openebench
ARG APP_BASE_URL=https://test2.openebench.bsc.es
ARG OEB_LEGACY_ANGULAR_URI=https://legacy.openebench.bsc.es/
ARG VRE_URI=https://dev-openebench.bsc.es/vre/home/
ARG OBSERVATORY_URI=https://observatory.openebench.bsc.es
ARG REST_API_URL=https://dev-openebench.bsc.es/monitor/rest/
ARG SCIENTIFIC_SERVICE_URL=https://dev-openebench.bsc.es/api/scientific/
ARG SCIENTIFIC_SERVICE_URL_API=https://dev-openebench.bsc.es/api/scientific/
ARG BENCH_EVENT_API_URL=https://dev-openebench.bsc.es/rest/bench_event_api
ARG KEYCLOAK_HOST=https://inb.bsc.es
ARG KEYCLOAK_REALM=dev-openebench
ARG KEYCLOAK_CLIENT_ID=oeb-frontend
ARG OBSERVATORY_API_URL=https://observatory.openebench.bsc.es/api
ARG GITHUBAPP_API_URL=https://observatory.openebench.bsc.es/githubapp/api
ARG AUTH_ORIGIN=https://inb.bsc.es
ENV ENVIRONMENT $ENVIRONMENT
ENV OEB_LEGACY_ANGULAR_URI $OEB_LEGACY_ANGULAR_URI
ENV VRE_URI $VRE_URI
ENV OBSERVATORY_URI $OBSERVATORY_URI
ENV REST_API_URL $REST_API_URL
ENV NUXT_SCIENTIFIC_SERVICE_URL $SCIENTIFIC_SERVICE_URL
ENV SCIENTIFIC_SERVICE_URL_API $SCIENTIFIC_SERVICE_URL_API
ENV BENCH_EVENT_API_URL $BENCH_EVENT_API_URL
ENV KEYCLOAK_HOST $KEYCLOAK_HOST
ENV KEYCLOAK_REALM $KEYCLOAK_REALM
ENV KEYCLOAK_CLIENT_ID $KEYCLOAK_CLIENT_ID
ENV OBSERVATORY_API_URL $OBSERVATORY_API_URL
ENV GITHUBAPP_API_URL $GITHUBAPP_API_URL
ENV APP_BASE_URL $APP_BASE_URL
ENV NODE_OPTIONS --openssl-legacy-provider
ENV AUTH_ORIGIN $AUTH_ORIGIN
ENV NITRO_PORT 3000
ENV NITRO_HOST 0.0.0.0
#WORKDIR /app
# # Copiar los archivos necesarios
# COPY package*.json ./
# COPY . .
# # Instalar dependencias y construir la aplicación
# RUN npm install
# RUN npm run build
# Copiar solo los archivos necesarios para instalar dependencias
COPY package*.json ./
RUN npm install
# Copiar el resto de los archivos y construir la aplicación
COPY . .
RUN npm run build
# Fase de producción: usar una imagen ligera de Nginx
FROM node:20
# Copiar las configuraciones de Nuxt para el servidor
COPY --from=build /app/.output /app/.output
EXPOSE 3000
#EXPOSE 80 3000
CMD ["node", "/app/.output/server/index.mjs"]
#COPY package*.json ./
# COPY package*.json ./
# COPY . .
# RUN npm install
# RUN npm run build
# # 2. Configurar Nginx como proxy inverso y ejecutar Nuxt
# FROM nginx:alpine
# # Copiar la configuración personalizada de Nginx
# COPY nginx_copy.conf /etc/nginx/conf.d/default.conf
# # Copiar los archivos construidos por Nuxt (estáticos y backend)
# COPY --from=build /app/.output/public /usr/share/nginx/html
# COPY --from=build /app/.output/server /var/www/nuxt
# # Instalar Node.js en la imagen de Nginx para correr el servidor Nuxt
# RUN apk add --no-cache nodejs npm
# # Configurar Nuxt como el servidor backend
# WORKDIR /var/www/nuxt
# # Instalar dependencias necesarias para el backend
# RUN npm install
# # Exponer puertos
# EXPOSE 80
# EXPOSE 3000
# # Iniciar el servidor de Nuxt y Nginx
# CMD ["sh", "-c", "node /var/www/nuxt/index.mjs & nginx -g 'daemon off;'"]
# Etapa de producción
# FROM nginx:latest
# WORKDIR /app
# COPY --from=build /app/.output /app/.output
# #COPY --from=build /app/.output/public /usr/share/nginx/html
# # Copiar configuración de Nginx personalizada
# COPY nginx_copy.conf /etc/nginx/conf.d/default.conf
# # Instalar Node.js para ejecutar el servidor Nuxt 3
# RUN apt-get update && apt-get install -y curl && \
# curl -fsSL https://deb.nodesource.com/setup_20.x | bash - && \
# apt-get install -y nodejs && \
# apt-get clean
# # Exponer los puertos necesarios
# EXPOSE 80 3000
# # Inicia Nuxt 3 y Nginx
# #CMD npm run preview & nginx -g "daemon off;"
# CMD node .output/server/index.mjs & nginx -g "daemon off;"
#CMD ["node", ".output/server/index.mjs"]