update runner from webhook
This commit is contained in:
76
Dockerfile
76
Dockerfile
@@ -1,59 +1,61 @@
|
|||||||
|
# Base image
|
||||||
FROM node:20-alpine AS base
|
FROM node:20-alpine AS base
|
||||||
|
|
||||||
# Install dependencies only when needed
|
|
||||||
FROM base AS deps
|
|
||||||
RUN apk add --no-cache libc6-compat curl
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
|
# -----------------------------
|
||||||
|
# Dependencies
|
||||||
|
# -----------------------------
|
||||||
|
FROM base AS deps
|
||||||
|
|
||||||
|
# Needed for some node modules
|
||||||
|
RUN apk add --no-cache libc6-compat
|
||||||
|
|
||||||
# Install Bun
|
# Install Bun
|
||||||
RUN npm install -g bun
|
RUN npm install -g bun
|
||||||
|
|
||||||
# Install dependencies based on the preferred package manager
|
# Copy lockfiles
|
||||||
COPY package.json yarn.lock* package-lock.json* pnpm-lock.yaml* bun.lock* ./
|
COPY package.json bun.lock* ./
|
||||||
RUN \
|
|
||||||
if [ -f bun.lock ]; then bun install --frozen-lockfile; \
|
# Install dependencies
|
||||||
elif [ -f yarn.lock ]; then yarn --frozen-lockfile; \
|
RUN bun install --frozen-lockfile
|
||||||
elif [ -f package-lock.json ]; then npm ci; \
|
|
||||||
elif [ -f pnpm-lock.yaml ]; then corepack enable pnpm && pnpm i --frozen-lockfile; \
|
|
||||||
else echo "Lockfile not found." && exit 1; \
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
# Rebuild the source code only when needed
|
# -----------------------------
|
||||||
|
# Builder
|
||||||
|
# -----------------------------
|
||||||
FROM base AS builder
|
FROM base AS builder
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
|
# Install Bun for build
|
||||||
|
RUN npm install -g bun
|
||||||
|
|
||||||
COPY --from=deps /app/node_modules ./node_modules
|
COPY --from=deps /app/node_modules ./node_modules
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
# Next.js collects completely anonymous telemetry data about general usage.
|
ENV NEXT_TELEMETRY_DISABLED=1
|
||||||
# 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
|
|
||||||
|
|
||||||
# Install Bun for build stage if needed (depending on script)
|
# Build Next.js
|
||||||
RUN npm install -g bun
|
RUN bun run build
|
||||||
|
|
||||||
RUN \
|
|
||||||
if [ -f bun.lock ]; then bun run build; \
|
|
||||||
else npm run build; \
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Production image, copy all the files and run next
|
# -----------------------------
|
||||||
FROM base AS runner
|
# Runner (Production)
|
||||||
|
# -----------------------------
|
||||||
|
FROM node:20-alpine AS runner
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
ENV NODE_ENV production
|
# Install tools for Coolify healthcheck
|
||||||
# Uncomment the following line in case you want to disable telemetry during runtime.
|
RUN apk add --no-cache curl wget libc6-compat
|
||||||
ENV NEXT_TELEMETRY_DISABLED 1
|
|
||||||
|
|
||||||
# Don't run as root
|
ENV NODE_ENV=production
|
||||||
|
ENV NEXT_TELEMETRY_DISABLED=1
|
||||||
|
|
||||||
|
# Create non-root user
|
||||||
RUN addgroup --system --gid 1001 nodejs
|
RUN addgroup --system --gid 1001 nodejs
|
||||||
RUN adduser --system --uid 1001 nextjs
|
RUN adduser --system --uid 1001 nextjs
|
||||||
|
|
||||||
|
# Copy built files
|
||||||
COPY --from=builder /app/public ./public
|
COPY --from=builder /app/public ./public
|
||||||
|
|
||||||
# Automatically leverage output traces to reduce image size
|
|
||||||
# https://nextjs.org/docs/advanced-features/output-file-tracing
|
|
||||||
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
|
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/.next/static ./.next/static
|
||||||
|
|
||||||
@@ -61,9 +63,7 @@ USER nextjs
|
|||||||
|
|
||||||
EXPOSE 3000
|
EXPOSE 3000
|
||||||
|
|
||||||
ENV PORT 3000
|
ENV PORT=3000
|
||||||
# set hostname to localhost
|
ENV HOSTNAME=0.0.0.0
|
||||||
ENV HOSTNAME "0.0.0.0"
|
|
||||||
|
|
||||||
CMD ["node", "server.js"]
|
|
||||||
|
|
||||||
|
CMD ["node", "server.js"]
|
||||||
Reference in New Issue
Block a user