From 9a67a1331246adb26250345d86fd71dec92ec175 Mon Sep 17 00:00:00 2001 From: Tudor Stanciu Date: Tue, 14 Apr 2020 17:51:31 +0300 Subject: [PATCH] updates for docker --- Dockerfile | 31 +++++++++++++++++++++++++++++-- Notes.txt | 19 +++++++++++++++++++ package-lock.json | 5 +++-- package.json | 2 +- 4 files changed, 52 insertions(+), 5 deletions(-) create mode 100644 Notes.txt diff --git a/Dockerfile b/Dockerfile index 8c6d2b2..e0aec3b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,13 +4,40 @@ 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 npm install + +#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 ["sh","-c","node serve -s build -p 80"] +#CMD ["npm", "run", "start:prod"] + +# Comenzile urmatoare sunt similare: +#CMD ["sh", "-c", "serve -s build -p 80"] +CMD ["serve", "-s", "build", "-p", "80"] \ No newline at end of file diff --git a/Notes.txt b/Notes.txt new file mode 100644 index 0000000..f2da88b --- /dev/null +++ b/Notes.txt @@ -0,0 +1,19 @@ +############################# +# Config initial scripts: # +############################# +"scripts": { + "start": "run-p start:dev start:api", + "start:dev": "webpack-dev-server --config webpack.config.dev.js --port 3000", + "prestart:api": "node tools/createMockDb.js", + "start:api": "node tools/apiServer.js", + "test": "jest --watch", + "test:ci": "jest", + "clean:build": "rimraf ./build && mkdir build", + "prebuild": "run-p clean:build test:ci", + "build": "webpack --config webpack.config.prod.js", + "postbuild": "run-p start:api serve:build", + "serve:build": "http-server ./build" + } + + - "postbuild" este apelat automat dupa "build" si este util in cazul in care se doreste ca aplicatia sa porneasca automat dupa executia unui build + - in cazul in care se doreste doar executia unui build, se elimina "postbuild". Poate fi redenumit in "start:prod" si rulat ulterior astfel "npm run start:prod" \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 23bbc60..b6b3e51 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,7 +1,8 @@ { - "name": "ps-redux", - "requires": true, + "name": "react-redux-course", + "version": "1.0.0", "lockfileVersion": 1, + "requires": true, "dependencies": { "@babel/code-frame": { "version": "7.8.3", diff --git a/package.json b/package.json index 1719593..6aefbcd 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,7 @@ "clean:build": "rimraf ./build && mkdir build", "prebuild": "run-p clean:build test:ci", "build": "webpack --config webpack.config.prod.js", - "postbuild": "run-p start:api serve:build", + "start:prod": "run-p start:api serve:build", "serve:build": "http-server ./build" }, "jest": {