use docker build args

This commit is contained in:
Chris Grimmett 2024-02-27 10:49:43 -08:00
parent 09ffd5588c
commit cf674f7cc6
3 changed files with 8 additions and 2 deletions

View File

@ -7,6 +7,12 @@ RUN corepack enable
FROM deps AS build FROM deps AS build
ARG NEXT_PUBLIC_SITE_URL=foo
ARG NEXT_PUBLIC_STRAPI_URL=foo
ARG NEXT_PUBLIC_UPPY_COMPANION_URL=foo
ENV NEXT_PUBLIC_SITE_URL ${NEXT_PUBLIC_SITE_URL}
ENV NEXT_PUBLIC_STRAPI_URL ${NEXT_PUBLIC_STRAPI_URL}
ENV NEXT_PUBLIC_UPPY_COMPANION_URL ${NEXT_PUBLIC_UPPY_COMPANION_URL}
WORKDIR /usr/src/app WORKDIR /usr/src/app
COPY . . COPY . .
ENV NEXT_TELEMETRY_DISABLED 1 ENV NEXT_TELEMETRY_DISABLED 1

View File

@ -2,7 +2,7 @@ if (!process.env.NEXT_PUBLIC_SITE_URL) throw new Error('NEXT_PUBLIC_SITE_URL was
if (!process.env.NEXT_PUBLIC_STRAPI_URL) throw new Error('NEXT_PUBLIC_STRAPI_URL was missing in env'); if (!process.env.NEXT_PUBLIC_STRAPI_URL) throw new Error('NEXT_PUBLIC_STRAPI_URL was missing in env');
if (!process.env.NEXT_PUBLIC_UPPY_COMPANION_URL) throw new Error('NEXT_PUBLIC_UPPY_COMPANION_URL undefined in env'); if (!process.env.NEXT_PUBLIC_UPPY_COMPANION_URL) throw new Error('NEXT_PUBLIC_UPPY_COMPANION_URL undefined in env');
export const companionUrl = process.env.NEXT_PUBLIC_UPPY_COMPANION_URL export const companionUrl = ''+process.env.NEXT_PUBLIC_UPPY_COMPANION_URL
export const siteUrl = ''+process.env.NEXT_PUBLIC_SITE_URL export const siteUrl = ''+process.env.NEXT_PUBLIC_SITE_URL
export const strapiUrl = ''+process.env.NEXT_PUBLIC_STRAPI_URL export const strapiUrl = ''+process.env.NEXT_PUBLIC_STRAPI_URL
export const patreonSupporterBenefitId: string = '4760169' export const patreonSupporterBenefitId: string = '4760169'

View File

@ -275,7 +275,7 @@ export async function getAllStreamsForVtuber(vtuberId: number, archiveStatuses =
}); });
console.log(`strapiUrl=${strapiUrl}`) console.log(`strapiUrl=${strapiUrl}`)
const response = await fetch(`${strapiUrl}/api/streams?${query}`, fetchStreamsOptions); const response = await fetch(`${strapiUrl}/api/streams?${query}`, fetchStreamsOptions)
if (response.status !== 200) { if (response.status !== 200) {
// If the response status is not 200 (OK), consider it a network failure // If the response status is not 200 (OK), consider it a network failure