1
Fork 0
mirror of https://github.com/Steffo99/todocolors.git synced 2024-10-16 07:17:28 +00:00

Significantly improve Dockerfile

https://github.com/vercel/next.js/tree/canary/examples/with-docker
This commit is contained in:
Steffo 2023-08-19 06:18:13 +02:00
parent d7f74b172a
commit 780488560e
Signed by: steffo
GPG key ID: 2A24051445686895
2 changed files with 18 additions and 5 deletions

View file

@ -1,14 +1,25 @@
FROM node:20.5.1
FROM node:20 AS base
FROM base AS builder
WORKDIR /usr/src/todoblue
COPY ./package.json ./yarn.lock ./
RUN yarn install
RUN yarn install --frozen-lockfile
COPY ./ ./
RUN yarn run build
ENTRYPOINT ["yarn", "run", "start", "--port=8081"]
FROM base AS runner
WORKDIR /usr/lib/todoblue
COPY --from=builder /usr/src/todoblue/public ./public
COPY --from=builder /usr/src/todoblue/.next/standalone ./
COPY --from=builder /usr/src/todoblue/.next/static ./static
ENV NODE_ENV production
ENTRYPOINT ["node", "server.js"]
CMD []
LABEL org.opencontainers.image.title="Todocolors Blue"
@ -17,4 +28,4 @@ LABEL org.opencontainers.image.licenses="AGPL-3.0-or-later"
LABEL org.opencontainers.image.url="https://github.com/Steffo99/todocolors"
LABEL org.opencontainers.image.authors="Stefano Pigozzi <me@steffo.eu>"
EXPOSE 8081
EXPOSE 3000

View file

@ -1,4 +1,6 @@
/** @type {import('next').NextConfig} */
const nextConfig = {}
const nextConfig = {
output: "standalone",
}
module.exports = nextConfig