Merge branch 'main' into PRWLR-4887-Invitations-users-integration

This commit is contained in:
Pablo Lara
2024-11-16 12:52:11 +01:00
2 changed files with 56 additions and 9 deletions
+1
View File
@@ -1,5 +1,6 @@
SITE_URL=http://localhost:3000
API_BASE_URL=http://localhost:8080/api/v1
AUTH_TRUST_HOST=true
# openssl rand -base64 32
AUTH_SECRET=your-secret-key
+55 -9
View File
@@ -1,24 +1,70 @@
# Base image for Node
FROM node:20-alpine AS base
LABEL maintainer="https://github.com/prowler-cloud"
# Install dependencies only when needed
FROM base AS deps
# Check https://github.com/nodejs/docker-node/tree/b4117f9333da4138b03a546ec926ef50a31506c3#nodealpine to understand why libc6-compat might be needed.
#hadolint ignore=DL3018
RUN apk add --no-cache libc6-compat
WORKDIR /app
# Install dependencies only when needed
RUN apk add --no-cache libc6-compat
# Copy package.json and lock files to install dependencies
# Install dependencies based on the preferred package manager
COPY package.json yarn.lock* package-lock.json* pnpm-lock.yaml* ./
RUN if [ -f package-lock.json ]; then npm install; else echo "Lockfile not found." && exit 1; fi
RUN \
if [ -f package-lock.json ]; then npm install; \
else echo "Lockfile not found." && exit 1; \
fi
# Copy the rest of the application code
# Rebuild the source code only when needed
FROM base AS builder
WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules
COPY . .
# Next.js collects completely anonymous telemetry data about general usage.
# 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
RUN \
if [ -f package-lock.json ]; then npm run build; \
else echo "Lockfile not found." && exit 1; \
fi
# Development stage
FROM base AS dev
WORKDIR /app
# Set up environment for development
ENV NODE_ENV=development
ENV NEXT_TELEMETRY_DISABLED=1
COPY --from=builder /app /app
# Run development server with hot-reloading
CMD ["npm", "run", "dev"]
# Production stage
FROM base AS prod
RUN npm run build
CMD ["npm", "start"]
WORKDIR /app
# Set up environment for production
ENV NODE_ENV=production
ENV NEXT_TELEMETRY_DISABLED=1
RUN addgroup --system --gid 1001 nodejs &&\
adduser --system --uid 1001 nextjs
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static
COPY --from=builder --chown=nextjs:nodejs /app/public ./public
USER nextjs
EXPOSE 3000
ENV PORT=3000
ENV HOSTNAME="0.0.0.0"
# server.js is created by next build from the standalone output
# https://nextjs.org/docs/pages/api-reference/next-config-js/output
CMD ["node", "server.js"]