# build environment FROM node:12 as builder WORKDIR /app COPY package*.json ./ RUN npm install #RUN printf '\nAm rulat npm install!\n\n' #RUN echo '\nRezultat:\n' #RUN ls COPY . ./ RUN npm run build #RUN printf '\nAm copiat restul fisierelor si am rulat build!\n\n' #RUN echo '\nRezultat:\n' #RUN ls # production environment FROM node:12 COPY --from=builder /app/build ./build #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 EXPOSE 80 #CMD ["npm", "run", "start:prod"] # Comenzile urmatoare sunt similare: #CMD ["sh", "-c", "serve -s build -p 80"] CMD ["serve", "-s", "build", "-p", "80"]