diff --git a/.gitignore b/.gitignore index e9afa2c..a9f3181 100644 --- a/.gitignore +++ b/.gitignore @@ -30,5 +30,6 @@ node_modules .env /.direnv/ +dist static !static/**/*.png \ No newline at end of file diff --git a/.licenseignore b/.licenseignore index dff8c55..159a719 100644 --- a/.licenseignore +++ b/.licenseignore @@ -6,6 +6,8 @@ **/*.env **/*.pug +dist/ + package.json yarn.lock robots.txt diff --git a/Dockerfile b/Dockerfile index 1256324..f233d18 100644 --- a/Dockerfile +++ b/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 \ No newline at end of file +CMD node ./dist/ \ No newline at end of file diff --git a/package.json b/package.json index 6255381..9d0ce1b 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/yarn.lock b/yarn.lock index f2a207e..e4cbb9b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -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"