mirror of
https://github.com/wahyd4/badger.git
synced 2026-08-09 05:15:58 +10:00
Minize node app docker image by following blog https://medium.com/trendyol-tech/how-we-reduce-node-docker-image-size-in-3-steps-ff2762b51d5a which reduced the image size from 700 mb to 330 mb
This commit is contained in:
@@ -1,2 +1,3 @@
|
||||
node_modules
|
||||
dist
|
||||
.git
|
||||
|
||||
+15
-5
@@ -1,14 +1,24 @@
|
||||
FROM node:alpine as build
|
||||
FROM node as build
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# copy the app, note .dockerignore
|
||||
COPY . /app
|
||||
|
||||
RUN apk update \
|
||||
&& apk add --no-cache git python alpine-sdk\
|
||||
&& npm ci \
|
||||
RUN npm ci \
|
||||
&& npm run build \
|
||||
&& npm run generate
|
||||
&& npm run generate \
|
||||
&& npm prune --production \
|
||||
&& curl -sf https://gobinaries.com/tj/node-prune | sh \
|
||||
&& node-prune
|
||||
|
||||
FROM node:alpine
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# copy from build image
|
||||
COPY --from=build /app ./
|
||||
|
||||
EXPOSE 3000
|
||||
|
||||
CMD [ "npm", "start" ]
|
||||
|
||||
+1
-5
@@ -1,9 +1,5 @@
|
||||
export default {
|
||||
/*
|
||||
** Nuxt rendering mode
|
||||
** See https://nuxtjs.org/api/configuration-mode
|
||||
*/
|
||||
mode: "universal",
|
||||
ssr: true,
|
||||
/*
|
||||
** Nuxt target
|
||||
** See https://nuxtjs.org/api/configuration-target
|
||||
|
||||
Reference in New Issue
Block a user