forked from Mirrors/keyoxide-web
Optimize docker builds
This commit is contained in:
parent
626faf2778
commit
c32da606ab
5 changed files with 18 additions and 8 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -30,5 +30,6 @@ node_modules
|
|||
.env
|
||||
/.direnv/
|
||||
|
||||
dist
|
||||
static
|
||||
!static/**/*.png
|
|
@ -6,6 +6,8 @@
|
|||
**/*.env
|
||||
**/*.pug
|
||||
|
||||
dist/
|
||||
|
||||
package.json
|
||||
yarn.lock
|
||||
robots.txt
|
||||
|
|
16
Dockerfile
16
Dockerfile
|
@ -1,23 +1,23 @@
|
|||
FROM node:14-alpine as builder
|
||||
FROM node:16-alpine as builder
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY . .
|
||||
|
||||
RUN yarn --pure-lockfile
|
||||
RUN yarn run build
|
||||
RUN yarn run build:static
|
||||
|
||||
###
|
||||
|
||||
FROM node:14-alpine
|
||||
FROM node:16-alpine
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY . .
|
||||
COPY --from=builder /app/package.json /app/package.json
|
||||
COPY --from=builder /app/dist /app/dist
|
||||
COPY --from=builder /app/content /app/content
|
||||
COPY --from=builder /app/views /app/views
|
||||
COPY --from=builder /app/static /app/static
|
||||
|
||||
RUN yarn --production --pure-lockfile
|
||||
|
||||
EXPOSE 3000
|
||||
|
||||
CMD yarn start
|
||||
CMD node ./dist/
|
|
@ -22,6 +22,7 @@
|
|||
"string-replace-middleware": "^1.0.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@vercel/ncc": "^0.33.3",
|
||||
"css-loader": "^6.6.0",
|
||||
"license-check-and-add": "^4.0.3",
|
||||
"mini-css-extract-plugin": "^2.5.3",
|
||||
|
@ -35,6 +36,7 @@
|
|||
"start": "node ./",
|
||||
"dev": "yarn run watch & yarn run build:static:dev",
|
||||
"watch": "./node_modules/.bin/nodemon --config nodemon.json ./",
|
||||
"build": "ncc build index.js -o dist",
|
||||
"build:static": "webpack --config webpack.config.js --env static=true --env mode=production",
|
||||
"build:static:dev": "webpack --config webpack.config.js --env static=true --env mode=development",
|
||||
"license:check": "./node_modules/.bin/license-check-and-add check",
|
||||
|
|
|
@ -455,6 +455,11 @@
|
|||
dependencies:
|
||||
"@types/node" "*"
|
||||
|
||||
"@vercel/ncc@^0.33.3":
|
||||
version "0.33.3"
|
||||
resolved "https://registry.yarnpkg.com/@vercel/ncc/-/ncc-0.33.3.tgz#aacc6b3ea9f7b175e0c9a18c9b97e4005a2f4fcc"
|
||||
integrity sha512-JGZ11QV+/ZcfudW2Cz2JVp54/pJNXbsuWRgSh2ZmmZdQBKXqBtIGrwI1Wyx8nlbzAiEFe7FHi4K1zX4//jxTnQ==
|
||||
|
||||
"@webassemblyjs/ast@1.11.1":
|
||||
version "1.11.1"
|
||||
resolved "https://registry.yarnpkg.com/@webassemblyjs/ast/-/ast-1.11.1.tgz#2bfd767eae1a6996f432ff7e8d7fc75679c0b6a7"
|
||||
|
|
Loading…
Reference in a new issue