updates for docker
parent
c18de01fdf
commit
9a67a13312
31
Dockerfile
31
Dockerfile
|
@ -4,13 +4,40 @@ WORKDIR /app
|
||||||
|
|
||||||
COPY package*.json ./
|
COPY package*.json ./
|
||||||
RUN npm install
|
RUN npm install
|
||||||
|
#RUN printf '\nAm rulat npm install!\n\n'
|
||||||
|
#RUN echo '\nRezultat:\n'
|
||||||
|
#RUN ls
|
||||||
|
|
||||||
|
|
||||||
COPY . ./
|
COPY . ./
|
||||||
RUN npm run build
|
RUN npm run build
|
||||||
|
|
||||||
|
#RUN printf '\nAm copiat restul fisierelor si am rulat build!\n\n'
|
||||||
|
#RUN echo '\nRezultat:\n'
|
||||||
|
#RUN ls
|
||||||
|
|
||||||
# production environment
|
# production environment
|
||||||
FROM node:12
|
FROM node:12
|
||||||
COPY --from=builder /app/build ./build
|
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
|
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"]
|
|
@ -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"
|
|
@ -1,7 +1,8 @@
|
||||||
{
|
{
|
||||||
"name": "ps-redux",
|
"name": "react-redux-course",
|
||||||
"requires": true,
|
"version": "1.0.0",
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
|
"requires": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@babel/code-frame": {
|
"@babel/code-frame": {
|
||||||
"version": "7.8.3",
|
"version": "7.8.3",
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
"clean:build": "rimraf ./build && mkdir build",
|
"clean:build": "rimraf ./build && mkdir build",
|
||||||
"prebuild": "run-p clean:build test:ci",
|
"prebuild": "run-p clean:build test:ci",
|
||||||
"build": "webpack --config webpack.config.prod.js",
|
"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"
|
"serve:build": "http-server ./build"
|
||||||
},
|
},
|
||||||
"jest": {
|
"jest": {
|
||||||
|
|
Loading…
Reference in New Issue