Staged Docker builds for dev and prod

This commit is contained in:
2022-10-11 16:24:15 +03:00
parent dde5a13550
commit 693ab863c2
5 changed files with 35 additions and 9 deletions

View File

@@ -1,5 +1,5 @@
# pull official node image
FROM node
FROM node AS dev
# define /app as working directory
WORKDIR /app
@@ -13,4 +13,10 @@ RUN npm install
COPY . /app
# launch node server
ENTRYPOINT npm run dev
# production
FROM node AS prod
WORKDIR /app
COPY --from=dev /app ./
ENTRYPOINT npm run start

View File

@@ -5,8 +5,8 @@
"main": "server.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "nodemon server.js -e ejs,js,css,html,jpg,png,scss",
"build": "cd frontend && npm install && npm run build"
"dev": "nodemon server.js -e ejs,js,css,html,jpg,png,scss",
"prod": "node.js server.js"
},
"keywords": [],
"author": "",