-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from chrisburr/dev
Adapt for Static Export and Dynamic API Location
- Loading branch information
Showing
11 changed files
with
72 additions
and
46 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,16 @@ | ||
FROM node:16-alpine | ||
EXPOSE 3000 | ||
|
||
# Set the working directory in the container | ||
# Minimize the size and complexity of the final Docker image by separating the | ||
# build stage and the runtime stage into two different steps | ||
FROM node:16-alpine AS build | ||
WORKDIR /app | ||
|
||
# Copy package.json and package-lock.json to the working directory | ||
# Install the project dependencies | ||
COPY package*.json ./ | ||
|
||
# Install project dependencies | ||
RUN npm install | ||
|
||
RUN npm ci | ||
# Copy the rest of the application to the working directory | ||
COPY . . | ||
# Build the static export with telemetry disabled (https://nextjs.org/telemetry) | ||
RUN NEXT_TELEMETRY_DISABLED=1 npm run build | ||
|
||
# Disable telemetry. Further details: https://nextjs.org/telemetry | ||
ENV NEXT_TELEMETRY_DISABLED 1 | ||
|
||
# Build the Next.js app for production | ||
RUN npm run build | ||
|
||
# Define the command to run the app | ||
CMD [ "npm", "start" ] | ||
# Copy the website from the previous container to a Nginx container | ||
FROM nginxinc/nginx-unprivileged:alpine | ||
EXPOSE 8080 | ||
COPY --from=build /app/out /usr/share/nginx/html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,9 @@ | ||
/** @type {import('next').NextConfig} */ | ||
const nextConfig = {}; | ||
const nextConfig = { | ||
output: "export", | ||
images: { | ||
unoptimized: true, | ||
}, | ||
}; | ||
|
||
module.exports = nextConfig; |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { useEffect, useState } from "react"; | ||
|
||
export function useDiracxUrl() { | ||
const [diracxUrl, setDiracxUrl] = useState<string | null>(null); | ||
|
||
useEffect(() => { | ||
// Ensure this runs on client side | ||
if (typeof window !== "undefined") { | ||
setDiracxUrl( | ||
(prevConfig) => `${window.location.protocol}//${window.location.host}`, | ||
); | ||
} | ||
}, []); | ||
|
||
return diracxUrl; | ||
} |