mirror of
https://github.com/MAGICGrants/campaign-site.git
synced 2026-01-09 12:27:59 -05:00
chore(Dockerfile): add necessary lines for prisma
This commit is contained in:
18
Dockerfile
18
Dockerfile
@@ -6,6 +6,9 @@ FROM base AS deps
|
||||
RUN apk add --no-cache libc6-compat
|
||||
WORKDIR /app
|
||||
|
||||
COPY prisma prisma
|
||||
ENV PRISMA_BINARY_TARGETS='["native", "rhel-openssl-1.0.x"]'
|
||||
|
||||
# Install dependencies based on the preferred package manager
|
||||
COPY package.json yarn.lock* package-lock.json* pnpm-lock.yaml* ./
|
||||
RUN \
|
||||
@@ -26,6 +29,9 @@ COPY . .
|
||||
# Learn more here: https://nextjs.org/telemetry
|
||||
# Uncomment the following line in case you want to disable telemetry during the build.
|
||||
ENV NEXT_TELEMETRY_DISABLED 1
|
||||
ENV SKIP_ENV_VALIDATION 1
|
||||
ENV PRISMA_BINARY_TARGETS='["native", "rhel-openssl-1.0.x"]'
|
||||
RUN npx prisma generate
|
||||
|
||||
RUN \
|
||||
if [ -f yarn.lock ]; then yarn run build; \
|
||||
@@ -41,10 +47,12 @@ WORKDIR /app
|
||||
ENV NODE_ENV production
|
||||
# Uncomment the following line in case you want to disable telemetry during runtime.
|
||||
ENV NEXT_TELEMETRY_DISABLED 1
|
||||
ENV SKIP_ENV_VALIDATION 1
|
||||
|
||||
RUN addgroup --system --gid 1001 nodejs
|
||||
RUN adduser --system --uid 1001 nextjs
|
||||
|
||||
COPY --from=builder /app/prisma ./prisma
|
||||
COPY --from=builder /app/public ./public
|
||||
|
||||
# Set the correct permission for prerender cache
|
||||
@@ -64,6 +72,14 @@ EXPOSE 3000
|
||||
|
||||
ENV PORT 3000
|
||||
|
||||
# Install Prisma CLI
|
||||
RUN mkdir /home/nextjs/.npm-global
|
||||
ENV PATH=/home/nextjs/.npm-global/bin:$PATH
|
||||
ENV NPM_CONFIG_PREFIX=/home/nextjs/.npm-global
|
||||
ENV PRISMA_BINARY_TARGETS='["native", "rhel-openssl-1.0.x"]'
|
||||
RUN npm install --quiet --no-progress -g prisma
|
||||
RUN npm cache clean --force
|
||||
|
||||
# server.js is created by next build from the standalone output
|
||||
# https://nextjs.org/docs/pages/api-reference/next-config-js/output
|
||||
CMD HOSTNAME="0.0.0.0" node server.js
|
||||
CMD ["/bin/sh", "-c", "prisma migrate deploy && HOSTNAME='0.0.0.0' node server.js"]
|
||||
Reference in New Issue
Block a user