push to maple-street
This commit is contained in:
+23
-3
@@ -7,6 +7,10 @@
|
||||
FROM node:22-alpine AS base
|
||||
WORKDIR /app
|
||||
ENV NODE_ENV=production
|
||||
# ImageMagick's LibRaw delegate decodes camera RAW files for the in-app editor;
|
||||
# sharp does the tone rendering and JPEG encode. The Postgres client provides
|
||||
# pg_dump/psql for admin backups and restores; unzip reads restore packages.
|
||||
RUN apk add --no-cache imagemagick libraw ffmpeg postgresql16-client unzip
|
||||
# pnpm is how this project is built (see package.json scripts).
|
||||
RUN npm install -g pnpm@9.15.0
|
||||
|
||||
@@ -18,22 +22,38 @@ RUN pnpm install --frozen-lockfile
|
||||
COPY . .
|
||||
RUN pnpm build
|
||||
|
||||
FROM node:22-alpine AS runner
|
||||
# ---------------------------------------------------------------------------
|
||||
# Tools stage — migrations + seed run from the builder image, which has the
|
||||
# source, `drizzle/` and dev dependencies (drizzle-kit, tsx). Keeping them out of
|
||||
# the runner keeps the serving image lean.
|
||||
# ---------------------------------------------------------------------------
|
||||
FROM builder AS tools
|
||||
ENV NODE_ENV=development
|
||||
CMD ["sh", "-c", "pnpm db:migrate && pnpm db:seed"]
|
||||
|
||||
FROM base AS runner
|
||||
WORKDIR /app
|
||||
ENV NODE_ENV=production
|
||||
# pnpm runs the app in production (see package.json scripts).
|
||||
RUN npm install -g pnpm@9.15.0
|
||||
# Inherits pnpm and the ImageMagick/LibRaw runtime tools from `base`.
|
||||
|
||||
# Run as a non-root user (busybox adduser/addgroup on alpine).
|
||||
RUN addgroup -S nodegrp \
|
||||
&& adduser -S -G nodegrp -H -D nextjs
|
||||
|
||||
# Some ImageMagick temporary work happens under /tmp; it is writable by all.
|
||||
RUN chmod 1777 /tmp
|
||||
|
||||
# Build output, deps, static assets.
|
||||
COPY --from=builder --chown=nextjs:nodegrp /app/public ./public
|
||||
COPY --from=builder --chown=nextjs:nodegrp /app/node_modules ./node_modules
|
||||
COPY --from=builder --chown=nextjs:nodegrp /app/package.json ./package.json
|
||||
COPY --from=builder --chown=nextjs:nodegrp /app/.next ./.next
|
||||
|
||||
# The console email transport writes here. Create it in the image owned by the
|
||||
# runtime user so a mounted named volume inherits that ownership (a root-owned
|
||||
# volume made every send fail with EACCES in the first deploy).
|
||||
RUN mkdir -p /tmp/outbox /tmp/uploads /archive && chown -R nextjs:nodegrp /tmp/outbox /tmp/uploads /archive
|
||||
|
||||
USER nextjs
|
||||
EXPOSE 3000
|
||||
ENV PORT=3000
|
||||
|
||||
Reference in New Issue
Block a user