kx3dex_radio/Dockerfile

45 lines
1.1 KiB
Docker
Raw Permalink Normal View History

2024-03-24 07:04:20 +00:00
# Install dependencies only when needed
2024-03-29 19:42:41 +00:00
FROM node:18-alpine3.19 AS deps
2024-03-24 07:04:20 +00:00
RUN apk add --no-cache libc6-compat
WORKDIR /app
2024-03-28 21:16:20 +00:00
COPY package.json yarn.lock ./
2024-03-30 03:54:19 +00:00
RUN yarn config set network-timeout 100000
2024-03-28 21:16:20 +00:00
RUN yarn install
2024-03-24 07:04:20 +00:00
2024-03-24 17:48:33 +00:00
# Rebuild the source code only when needed
2024-03-29 19:42:41 +00:00
FROM node:18-alpine3.19 AS builder
2024-03-28 21:16:20 +00:00
2024-03-24 07:04:20 +00:00
WORKDIR /app
2024-03-28 21:16:20 +00:00
2024-03-24 07:04:20 +00:00
COPY --from=deps /app/node_modules ./node_modules
2024-03-28 21:16:20 +00:00
2024-03-24 07:04:20 +00:00
COPY . .
2024-03-28 21:16:20 +00:00
RUN yarn build
2024-03-24 07:04:20 +00:00
# Production image, copy all the files and run next
2024-03-29 19:42:41 +00:00
FROM node:18-alpine3.19 AS runner
2024-03-24 07:04:20 +00:00
WORKDIR /app
ENV NODE_ENV production
RUN addgroup --system --gid 1001 kx3dex_radio
RUN adduser --system --uid 1001 kx3dex_radio
COPY --from=builder /app/public ./public
2024-03-28 21:16:20 +00:00
COPY --from=builder /app/package.json ./package.json
2024-03-24 07:04:20 +00:00
# Automatically leverage output traces to reduce image size
# https://nextjs.org/docs/advanced-features/output-file-tracing
2024-03-24 17:48:33 +00:00
COPY --from=builder --chown=kx3dex_radio:kx3dex_radio /app/.next/standalone ./
2024-03-24 07:04:20 +00:00
COPY --from=builder --chown=kx3dex_radio:kx3dex_radio /app/.next/static ./.next/static
USER kx3dex_radio
EXPOSE 3000
ENV PORT 3000
ENV HOSTNAME "0.0.0.0"
2024-03-24 18:24:51 +00:00
CMD ["node", "server.js"]