This repository has been archived on 2024-06-14. You can view files and clone it, but cannot push or open issues or pull requests.
icynet-admin/Dockerfile

51 lines
1.1 KiB
Docker
Raw Permalink Normal View History

2022-11-27 08:15:00 +00:00
###################
# DEPENDENCIES
###################
FROM node:18-alpine AS deps
RUN apk add --no-cache libc6-compat
USER node
WORKDIR /app
COPY --chown=node:node package*.json ./
RUN npm ci
###################
# BUILDER
###################
FROM node:18-alpine AS builder
USER node
WORKDIR /app
COPY --chown=node:node --from=deps /app/node_modules ./node_modules
COPY --chown=node:node . .
2022-11-27 10:17:00 +00:00
ENV NODE_ENV production
ENV NEXT_PUBLIC_URL APP_NEXT_PUBLIC_URL
ENV NEXT_PUBLIC_UPLOADS_URL APP_NEXT_PUBLIC_UPLOADS_URL
2022-11-27 08:15:00 +00:00
RUN npm run build
RUN npm ci --omit=dev && npm cache clean --force
###################
# PRODUCTION
###################
FROM node:18-alpine AS runner
USER node
WORKDIR /app
ENV NODE_ENV production
COPY --chown=node:node --from=builder /app/node_modules ./node_modules
COPY --chown=node:node --from=builder /app/package*.json ./
2022-11-27 10:17:00 +00:00
COPY --chown=node:node --from=builder /app/entrypoint.sh ./
2022-11-27 08:15:00 +00:00
2022-11-27 10:17:00 +00:00
COPY --chown=node:node --from=builder /app/next.config.js ./
2022-11-27 08:15:00 +00:00
COPY --chown=node:node --from=builder /app/public ./public
COPY --chown=node:node --from=builder /app/.next ./.next
EXPOSE 3000
2022-11-27 10:17:00 +00:00
ENTRYPOINT ["/app/entrypoint.sh"]
2022-11-27 08:15:00 +00:00
CMD ["node_modules/.bin/next", "start"]