-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdockerfile.stages
More file actions
30 lines (28 loc) · 931 Bytes
/
dockerfile.stages
File metadata and controls
30 lines (28 loc) · 931 Bytes
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
# Node modified which have pnpm installed
FROM node:alpine as base
RUN npm i -g pnpm && \
pnpm config set shamefully-hoist=true
FROM base AS back_front_builder
WORKDIR /
COPY ./ ./
# BackEnd compilation
WORKDIR /BackEnd
RUN pnpm i && (cd ../sharedCode; pnpm i) && pnpm run build &&\
pnpm i -P
RUN rm -f .env && mv .envProd .env
# FrontEnd compilation
WORKDIR /FrontEnd
RUN pnpm i && \
pnpm run build:prod && \
mv dist ../dist &&\
rm -rf * \
&& mv ../dist ./dist
# Imagen final que se copia el compilado del backend (dist), la dependencias de producción y el compilado del front
FROM node:alpine
WORKDIR /app
COPY --from=back_front_builder /BackEnd/dist ./dist
COPY --from=back_front_builder ["/BackEnd/package.json", "/BackEnd/.env", "./" ]
COPY --from=back_front_builder /BackEnd/node_modules ./node_modules
COPY --from=back_front_builder /FrontEnd/dist/FrontEnd ./ngDist
EXPOSE 3000
CMD [ "npm", "run", "start:prod" ]