owltide/Dockerfile

38 lines
850 B
Text
Raw Normal View History

# syntax=docker.io/docker/dockerfile:1
# SPDX-FileCopyrightText: © 2025 Hornwitser <code@hornwitser.no>
# SPDX-License-Identifier: AGPL-3.0-or-later
# Based on Next.js's docker image example
FROM node:22 AS base
# Install dependencies only when needed
FROM base AS deps
WORKDIR /app
COPY package.json pnpm-lock.yaml* ./
RUN corepack enable pnpm && pnpm i --frozen-lockfile
# Rebuild the source code only when needed
FROM base AS builder
WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules
COPY . .
RUN corepack enable pnpm && pnpm run build
# Production image, copy all the files and run Nuxt
FROM base AS runner
WORKDIR /app
COPY --from=builder /app/.output ./
RUN install --owner=node --group=node --directory data
VOLUME [ "/app/data" ]
USER node
EXPOSE 3000
ENV PORT=3000
ENV HOST="0.0.0.0"
CMD ["node", "server/index.mjs"]