Fix deploying process.
This commit is contained in:
+8
-1
@@ -11,6 +11,10 @@ RUN npm ci --prefer-offline --no-audit
|
||||
# Copy the rest of the application code
|
||||
COPY . .
|
||||
|
||||
# Pass build-time environment variables
|
||||
ARG BACKEND_URL
|
||||
ENV BACKEND_URL=${BACKEND_URL}
|
||||
|
||||
# Build the Next.js app
|
||||
RUN npm run build
|
||||
|
||||
@@ -26,6 +30,9 @@ COPY --from=builder /app/public ./public
|
||||
COPY --from=builder /app/package.json ./package.json
|
||||
COPY --from=builder /app/node_modules ./node_modules
|
||||
|
||||
# Runtime environment variables
|
||||
ENV BACKEND_URL=${BACKEND_URL}
|
||||
|
||||
EXPOSE 3000
|
||||
|
||||
CMD ["npm", "start"]
|
||||
CMD ["npm", "start"]
|
||||
@@ -2,6 +2,9 @@ import type { NextConfig } from "next";
|
||||
|
||||
const nextConfig: NextConfig = {
|
||||
/* config options here */
|
||||
env: {
|
||||
BACKEND_URL: process.env.BACKEND_URL,
|
||||
},
|
||||
};
|
||||
|
||||
export default nextConfig;
|
||||
|
||||
@@ -10,9 +10,7 @@ export default function HealthStatus() {
|
||||
const checkHealth = async () => {
|
||||
try {
|
||||
setLoading(true);
|
||||
const response = await fetch(
|
||||
`${process.env.NEXT_PUBLIC_BACKEND_URL}/health`
|
||||
);
|
||||
const response = await fetch(`${process.env.BACKEND_URL}/health`);
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error(`Server responded with status: ${response.status}`);
|
||||
|
||||
@@ -36,7 +36,7 @@ export function AuthProvider({ children }: { children: ReactNode }) {
|
||||
const checkAuthStatus = async () => {
|
||||
try {
|
||||
const response = await fetch(
|
||||
`${process.env.NEXT_PUBLIC_BACKEND_URL}/auth/user-id-token-claims`,
|
||||
`${process.env.BACKEND_URL}/auth/user-id-token-claims`,
|
||||
{
|
||||
credentials: "include",
|
||||
}
|
||||
@@ -60,11 +60,11 @@ export function AuthProvider({ children }: { children: ReactNode }) {
|
||||
};
|
||||
|
||||
const login = () => {
|
||||
window.location.href = `${process.env.NEXT_PUBLIC_BACKEND_URL}/auth/sign-in`;
|
||||
window.location.href = `${process.env.BACKEND_URL}/auth/sign-in`;
|
||||
};
|
||||
|
||||
const logout = () => {
|
||||
window.location.href = `${process.env.NEXT_PUBLIC_BACKEND_URL}/auth/sign-out`;
|
||||
window.location.href = `${process.env.BACKEND_URL}/auth/sign-out`;
|
||||
};
|
||||
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user