chore: reduce docker image size
This commit is contained in:
parent
734357b396
commit
12ceefd650
18
Dockerfile
18
Dockerfile
@ -1,23 +1,21 @@
|
|||||||
FROM node:16.17.0 AS dependencies
|
FROM node:18.12.1 AS dependencies
|
||||||
WORKDIR /usr/src/app
|
WORKDIR /usr/src/app
|
||||||
COPY ./package*.json ./
|
COPY ./package*.json ./
|
||||||
RUN npm install
|
RUN npm install
|
||||||
|
|
||||||
FROM node:16.17.0 AS builder
|
FROM node:18.12.1 AS builder
|
||||||
WORKDIR /usr/src/app
|
WORKDIR /usr/src/app
|
||||||
COPY ./ ./
|
COPY ./ ./
|
||||||
COPY --from=dependencies /usr/src/app/node_modules ./node_modules
|
COPY --from=dependencies /usr/src/app/node_modules ./node_modules
|
||||||
RUN npm run build
|
RUN npm run build
|
||||||
|
|
||||||
FROM node:16.17.0 AS runner
|
FROM node:18.12.1 AS runner
|
||||||
WORKDIR /usr/src/app
|
WORKDIR /usr/src/app
|
||||||
ENV NODE_ENV=production
|
ENV NODE_ENV=production
|
||||||
COPY --from=builder /usr/src/app/next.config.js ./next.config.js
|
ENV NEXT_TELEMETRY_DISABLED=1
|
||||||
|
COPY --from=builder /usr/src/app/.next/standalone ./
|
||||||
|
COPY --from=builder /usr/src/app/.next/static ./.next/static
|
||||||
COPY --from=builder /usr/src/app/public ./public
|
COPY --from=builder /usr/src/app/public ./public
|
||||||
COPY --from=builder /usr/src/app/.next ./.next
|
|
||||||
COPY --from=builder /usr/src/app/i18n.json ./i18n.json
|
|
||||||
COPY --from=builder /usr/src/app/locales ./locales
|
COPY --from=builder /usr/src/app/locales ./locales
|
||||||
COPY --from=builder /usr/src/app/pages ./pages
|
COPY --from=builder /usr/src/app/next.config.js ./next.config.js
|
||||||
COPY --from=builder /usr/src/app/node_modules ./node_modules
|
CMD ["node", "server.js"]
|
||||||
RUN npx next telemetry disable
|
|
||||||
CMD ["node_modules/.bin/next", "start", "--port", "${PORT}"]
|
|
||||||
|
@ -5,7 +5,7 @@ services:
|
|||||||
build:
|
build:
|
||||||
context: './'
|
context: './'
|
||||||
ports:
|
ports:
|
||||||
- '${PORT}:${PORT}'
|
- '${PORT-3000}:${PORT-3000}'
|
||||||
environment:
|
environment:
|
||||||
PORT: ${PORT}
|
PORT: ${PORT-3000}
|
||||||
env_file: './.env'
|
env_file: './.env'
|
||||||
|
@ -5,16 +5,16 @@ const nextPWA = require('next-pwa')({
|
|||||||
const nextTranslate = require('next-translate')
|
const nextTranslate = require('next-translate')
|
||||||
|
|
||||||
/** @type {import("next").NextConfig} */
|
/** @type {import("next").NextConfig} */
|
||||||
module.exports = nextTranslate(
|
const nextConfig = {
|
||||||
nextPWA({
|
reactStrictMode: false,
|
||||||
reactStrictMode: false,
|
output: 'standalone',
|
||||||
images: {
|
images: {
|
||||||
domains: [
|
domains: [
|
||||||
'api.thream.divlo.fr',
|
'api.thream.divlo.fr',
|
||||||
'thream-api.herokuapp.com',
|
'file-uploads-api.thream.divlo.fr',
|
||||||
'file-uploads-api.thream.divlo.fr',
|
...(process.env.NODE_ENV !== 'production' ? ['127.0.0.1'] : [])
|
||||||
...(process.env.NODE_ENV !== 'production' ? ['localhost'] : [])
|
]
|
||||||
]
|
}
|
||||||
}
|
}
|
||||||
})
|
|
||||||
)
|
module.exports = nextTranslate(nextPWA(nextConfig))
|
||||||
|
Reference in New Issue
Block a user