2020-04-12 04:09:41 +03:00
|
|
|
# build environment
|
|
|
|
FROM node:12 as builder
|
|
|
|
WORKDIR /app
|
|
|
|
|
|
|
|
COPY package*.json ./
|
|
|
|
RUN npm install
|
2020-04-14 17:51:31 +03:00
|
|
|
#RUN printf '\nAm rulat npm install!\n\n'
|
|
|
|
#RUN echo '\nRezultat:\n'
|
|
|
|
#RUN ls
|
|
|
|
|
2020-04-12 04:09:41 +03:00
|
|
|
|
|
|
|
COPY . ./
|
|
|
|
RUN npm run build
|
|
|
|
|
2020-04-14 17:51:31 +03:00
|
|
|
#RUN printf '\nAm copiat restul fisierelor si am rulat build!\n\n'
|
|
|
|
#RUN echo '\nRezultat:\n'
|
|
|
|
#RUN ls
|
|
|
|
|
2020-04-12 04:09:41 +03:00
|
|
|
# production environment
|
|
|
|
FROM node:12
|
|
|
|
COPY --from=builder /app/build ./build
|
2020-04-14 17:51:31 +03:00
|
|
|
|
|
|
|
#RUN printf '\nAm copiat fisierele din build in imaginea finala!\n\n'
|
|
|
|
#RUN echo '\nRezultat:\n'
|
|
|
|
#RUN ls
|
|
|
|
|
|
|
|
#RUN printf '\nM-am mutat in directorul build!\n\n'
|
|
|
|
#RUN echo '\nRezultat:\n'
|
|
|
|
#RUN ls
|
|
|
|
|
|
|
|
#install static server
|
|
|
|
RUN npm install -g serve
|
|
|
|
|
|
|
|
#RUN printf '\nAm rulat npm install in imaginea finala!\n\n'
|
|
|
|
#RUN echo '\nRezultat:\n'
|
|
|
|
#RUN ls
|
|
|
|
|
2020-04-12 04:09:41 +03:00
|
|
|
EXPOSE 80
|
2020-04-14 17:51:31 +03:00
|
|
|
#CMD ["npm", "run", "start:prod"]
|
|
|
|
|
|
|
|
# Comenzile urmatoare sunt similare:
|
|
|
|
#CMD ["sh", "-c", "serve -s build -p 80"]
|
|
|
|
CMD ["serve", "-s", "build", "-p", "80"]
|