CoastalCommitsPastes/client/Dockerfile

51 lines
1 KiB
Text
Raw Permalink Normal View History

FROM node:17-alpine AS deps
2022-03-07 23:42:44 -05:00
# Check https://github.com/nodejs/docker-node/tree/b4117f9333da4138b03a546ec926ef50a31506c3#nodealpine to understand why libc6-compat might be needed.
RUN apk add --no-cache libc6-compat
2022-03-07 23:42:44 -05:00
WORKDIR /app
2022-03-07 23:42:44 -05:00
COPY package.json yarn.lock ./
2022-03-07 23:42:44 -05:00
RUN yarn install --frozen-lockfile
FROM node:17-alpine AS builder
2022-03-07 23:42:44 -05:00
WORKDIR /app
2022-03-07 23:42:44 -05:00
COPY --from=deps /app/node_modules ./node_modules
COPY . .
ARG API_URL
ENV NEXT_TELEMETRY_DISABLED=1
ENV API_URL=${API_URL:-http://localhost:3000}
2022-03-07 23:42:44 -05:00
RUN yarn build
FROM node:17-alpine AS runner
2022-03-07 23:42:44 -05:00
WORKDIR /app
ARG NODE_ENV
2022-03-07 23:42:44 -05:00
ENV NEXT_TELEMETRY_DISABLED=1
ENV NODE_ENV=${NODE_ENV:-production}
2022-03-07 23:42:44 -05:00
RUN addgroup --system --gid 1001 nodejs
RUN adduser --system --uid 1001 nextjs
COPY --from=builder /app/next.config.mjs ./
2022-03-07 23:42:44 -05:00
COPY --from=builder /app/public ./public
COPY --from=builder /app/package.json ./package.json
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static
USER nextjs
ENV PORT=3001
2022-03-07 23:42:44 -05:00
EXPOSE 3001
2022-03-07 23:42:44 -05:00
CMD ["node", "server.js"]