Go back to basic next copy

This commit is contained in:
shamoon
2025-03-28 17:41:31 -07:00
parent 0fc69ef469
commit 5627c4a2b7
2 changed files with 22 additions and 19 deletions

View File

@@ -40,7 +40,7 @@ jobs:
with: with:
version: 10 version: 10
run_install: false run_install: false
- name: Install Node.js - name: Setup Node.js
uses: actions/setup-node@v4 uses: actions/setup-node@v4
with: with:
node-version: 20 node-version: 20
@@ -88,7 +88,7 @@ jobs:
version: 10 version: 10
run_install: false run_install: false
- name: Install Node.js - name: Setup Node.js
uses: actions/setup-node@v4 uses: actions/setup-node@v4
with: with:
node-version: 20 node-version: 20
@@ -97,7 +97,7 @@ jobs:
- name: Install dependencies - name: Install dependencies
run: pnpm install run: pnpm install
- name: Build Next.js app - name: Build app
run: | run: |
NEXT_PUBLIC_BUILDTIME="${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.created'] }}" \ NEXT_PUBLIC_BUILDTIME="${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.created'] }}" \
NEXT_PUBLIC_VERSION="${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.version'] }}" \ NEXT_PUBLIC_VERSION="${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.version'] }}" \

View File

@@ -1,16 +1,18 @@
# Base build stage (for building Next.js if needed) # =========================
# Builder Stage
# =========================
FROM node:22-slim AS builder FROM node:22-slim AS builder
WORKDIR /app WORKDIR /app
# Setup
RUN mkdir config RUN mkdir config
COPY package.json pnpm-lock.yaml ./ COPY package.json pnpm-lock.yaml ./
RUN corepack enable && corepack prepare pnpm@latest --activate RUN corepack enable && corepack prepare pnpm@latest --activate
RUN pnpm install --frozen-lockfile --prefer-offline RUN pnpm install --frozen-lockfile --prefer-offline
# Copy all source files, .next dir included # Copy source
COPY . . COPY . .
COPY .next .next
ARG CI ARG CI
ARG BUILDTIME ARG BUILDTIME
@@ -20,19 +22,20 @@ ARG REVISION
# Make CI available in RUN steps # Make CI available in RUN steps
ENV CI=$CI ENV CI=$CI
# Build only if needed (local use)
RUN pnpm run telemetry \ RUN pnpm run telemetry \
&& if [ "$CI" != "true" ]; then \ && if [ "$CI" != "true" ]; then \
NEXT_PUBLIC_BUILDTIME=$BUILDTIME \ NEXT_PUBLIC_BUILDTIME=$BUILDTIME \
NEXT_PUBLIC_VERSION=$VERSION \ NEXT_PUBLIC_VERSION=$VERSION \
NEXT_PUBLIC_REVISION=$REVISION \ NEXT_PUBLIC_REVISION=$REVISION \
pnpm run build; \ pnpm run build; \
else \ else \
echo "Skipping build in CI (already built)"; \ echo "✅ Using prebuilt .next from CI context"; \
fi fi
# Final runtime image # =========================
FROM docker.io/node:22-alpine AS runner # Runtime Stage
# =========================
FROM node:22-alpine AS runner
LABEL org.opencontainers.image.title "Homepage" LABEL org.opencontainers.image.title "Homepage"
LABEL org.opencontainers.image.description "A self-hosted services landing page, with docker and service integrations." LABEL org.opencontainers.image.description "A self-hosted services landing page, with docker and service integrations."
LABEL org.opencontainers.image.url="https://github.com/gethomepage/homepage" LABEL org.opencontainers.image.url="https://github.com/gethomepage/homepage"
@@ -43,7 +46,7 @@ LABEL org.opencontainers.image.licenses='Apache-2.0'
WORKDIR /app WORKDIR /app
ENV NODE_ENV=production ENV NODE_ENV=production
# Trust the traced production app output — no reinstall needed # Copy only necessary files from the build stage
COPY --from=builder --chown=1000:1000 /app/.next/standalone/ ./ COPY --from=builder --chown=1000:1000 /app/.next/standalone/ ./
COPY --from=builder --chown=1000:1000 /app/.next/static ./.next/static COPY --from=builder --chown=1000:1000 /app/.next/static ./.next/static
COPY --from=builder --chown=1000:1000 /app/public ./public COPY --from=builder --chown=1000:1000 /app/public ./public