rxc-app/Dockerfile

46 lines
1.1 KiB
Docker

# 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
COPY --from=builder /app/tools/mockData.js ./build/api/
COPY --from=builder /app/tools/createMockDb.js ./build/api/
COPY --from=builder /app/tools/apiServer.js ./build/api/
#RUN printf '\nAm copiat fisierele din build in imaginea finala!\n\n'
#RUN echo '\nRezultat:\n'
#RUN ls
#install static server || Alternativ se poate utiliza si http-server
RUN npm install -g serve
WORKDIR /build
RUN npm install json-server --save-prod
RUN printf '\n- Am instalat json-server!\n\n'
#RUN ls
WORKDIR /
EXPOSE 80
#CMD ["sh", "-c", "node build/api/createMockDb.js && node build/api/apiServer.js && serve -s build -p 80"]
#CMD ["serve", "-s", "build", "-p", "80"]
#CMD ["sh", "-c", "node build/api/createMockDb.js && node build/api/apiServer.js", "serve", "-s", "build", "-p", "80"]