49 lines
1.3 KiB
Docker
49 lines
1.3 KiB
Docker
# ---------- Build Stage ----------
|
|
FROM node:20-alpine AS builder
|
|
|
|
# pnpm is served by corepack and pinned by "packageManager" in the root package.json
|
|
RUN corepack enable
|
|
|
|
ARG NUXT_PUBLIC_GIT_COMMIT
|
|
ARG NUXT_PUBLIC_GIT_TAG
|
|
ARG NUXT_PUBLIC_GIT_BRANCH
|
|
|
|
ENV NUXT_PUBLIC_GIT_COMMIT=$NUXT_PUBLIC_GIT_COMMIT
|
|
ENV NUXT_PUBLIC_GIT_TAG=$NUXT_PUBLIC_GIT_TAG
|
|
ENV NUXT_PUBLIC_GIT_BRANCH=$NUXT_PUBLIC_GIT_BRANCH
|
|
|
|
WORKDIR /app
|
|
|
|
# Copy the workspace manifests (pnpm needs every package.json of the workspace)
|
|
COPY pnpm-workspace.yaml pnpm-lock.yaml package.json ./
|
|
COPY backend/package.json ./backend/
|
|
COPY frontend/package.json ./frontend/
|
|
COPY discord-bot/package.json ./discord-bot/
|
|
|
|
# Install the dependencies of the frontend package
|
|
RUN pnpm install --frozen-lockfile --filter ./frontend...
|
|
|
|
# Copy project files
|
|
ARG CACHEBUST=1
|
|
COPY frontend ./frontend
|
|
|
|
# Build the Nuxt app
|
|
RUN pnpm --filter ./frontend run build
|
|
|
|
# ---------- Production Stage ----------
|
|
FROM node:20-alpine
|
|
|
|
WORKDIR /app
|
|
|
|
# Copy built output
|
|
COPY --from=builder /app/frontend/.output ./.output
|
|
|
|
# Source of the Foundry module, zipped on demand by /foundry/dragonroll-foundry.zip
|
|
COPY dragonroll-foundry ./dragonroll-foundry
|
|
|
|
# Expose Nuxt port
|
|
EXPOSE 3000
|
|
|
|
# Start Nuxt production server
|
|
CMD ["node", ".output/server/index.mjs"]
|