chore: changes for deployment to get the pocketbase public url variable value
This commit is contained in:
@@ -24,6 +24,8 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
push: true
|
push: true
|
||||||
|
build-args: |
|
||||||
|
PB_PUBLIC_URL=${{ vars.PB_PUBLIC_URL }}
|
||||||
tags: |
|
tags: |
|
||||||
docker.allmy.work/${{ gitea.repository }}:latest
|
docker.allmy.work/${{ gitea.repository }}:latest
|
||||||
docker.allmy.work/${{ gitea.repository }}:${{ gitea.sha }}
|
docker.allmy.work/${{ gitea.repository }}:${{ gitea.sha }}
|
||||||
|
|||||||
@@ -7,6 +7,8 @@ RUN yarn install --immutable
|
|||||||
FROM node:22-alpine AS builder
|
FROM node:22-alpine AS builder
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
RUN corepack enable
|
RUN corepack enable
|
||||||
|
ARG PB_PUBLIC_URL
|
||||||
|
ENV PB_PUBLIC_URL=$PB_PUBLIC_URL
|
||||||
COPY --from=deps /app/node_modules ./node_modules
|
COPY --from=deps /app/node_modules ./node_modules
|
||||||
COPY . .
|
COPY . .
|
||||||
ENV NEXT_TELEMETRY_DISABLED=1
|
ENV NEXT_TELEMETRY_DISABLED=1
|
||||||
@@ -22,6 +24,7 @@ RUN addgroup -S -g 1001 nodejs && adduser -S -u 1001 -G nodejs nextjs
|
|||||||
COPY --from=builder /app/public ./public
|
COPY --from=builder /app/public ./public
|
||||||
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
|
||||||
|
RUN mkdir -p .next/cache && chown -R nextjs:nodejs .next/cache
|
||||||
USER nextjs
|
USER nextjs
|
||||||
EXPOSE 3000
|
EXPOSE 3000
|
||||||
CMD ["node", "server.js"]
|
CMD ["node", "server.js"]
|
||||||
+6
-4
@@ -1,8 +1,10 @@
|
|||||||
import type { NextConfig } from 'next';
|
import type { NextConfig } from 'next';
|
||||||
|
|
||||||
/* PocketBase origin — used to allowlist remote images.
|
/* Public PocketBase host for the image optimizer allowlist.
|
||||||
* PB_HOSTNAME and PB_PORT are server-only env vars; safe to read here. */
|
* Derived from PB_PUBLIC_URL (e.g. https://cms.allmy.work) at BUILD time —
|
||||||
const pbHostname = process.env.PB_HOSTNAME ?? '127.0.0.1';
|
* remotePatterns is frozen into the build, so PB_PUBLIC_URL must be present
|
||||||
|
* during `next build` in CI (via build-arg), not just at runtime. */
|
||||||
|
const pbPublicHost = process.env.PB_PUBLIC_URL ? new URL(process.env.PB_PUBLIC_URL).hostname : '127.0.0.1';
|
||||||
|
|
||||||
const nextConfig: NextConfig = {
|
const nextConfig: NextConfig = {
|
||||||
output: 'standalone',
|
output: 'standalone',
|
||||||
@@ -11,7 +13,7 @@ const nextConfig: NextConfig = {
|
|||||||
remotePatterns: [
|
remotePatterns: [
|
||||||
{
|
{
|
||||||
protocol: 'https',
|
protocol: 'https',
|
||||||
hostname: pbHostname,
|
hostname: pbPublicHost,
|
||||||
pathname: '/api/files/**',
|
pathname: '/api/files/**',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
|||||||
Reference in New Issue
Block a user