Fix Docker build context paths and add runtime API URL configuration

Co-authored-by: johndoe6345789 <224850594+johndoe6345789@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2025-12-29 08:09:02 +00:00
parent 428ec2e20f
commit eb1acaf711
9 changed files with 9 additions and 14 deletions

View File

@@ -3,14 +3,14 @@ FROM python:3.11-slim
WORKDIR /app
# Install dependencies
COPY requirements.txt .
COPY backend/requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Copy application files
COPY app.py auth.py ./
COPY backend/app.py backend/auth.py backend/config_db.py ./
# Copy schema from parent directory
COPY ../schema.json /app/schema.json
COPY schema.json /app/schema.json
# Create data directory
RUN mkdir -p /data/blobs /data/meta

View File

@@ -24,7 +24,7 @@ services:
ports:
- "3000:3000"
environment:
- API_URL=http://backend:5000
- NEXT_PUBLIC_API_URL=http://backend:5000
- NODE_ENV=production
depends_on:
- backend

View File

@@ -14,8 +14,6 @@ WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules
COPY . .
# Set API URL for build (can be overridden at runtime)
ENV API_URL=http://backend:5000
ENV NEXT_TELEMETRY_DISABLED=1
RUN npm run build

View File

@@ -1,8 +1,5 @@
/** @type {import('next').NextConfig} */
const nextConfig = {
env: {
API_URL: process.env.API_URL || 'http://localhost:5000',
},
output: 'standalone',
}

View File

@@ -50,7 +50,7 @@ export default function AccountPage() {
setLoading(true);
try {
const apiUrl = process.env.API_URL || 'http://localhost:5000';
const apiUrl = process.env.NEXT_PUBLIC_API_URL || 'http://localhost:5000';
const token = localStorage.getItem('token');
const response = await fetch(`${apiUrl}/auth/change-password`, {

View File

@@ -35,7 +35,7 @@ export default function AdminPage() {
const fetchConfig = async () => {
try {
const apiUrl = process.env.API_URL || 'http://localhost:5000';
const apiUrl = process.env.NEXT_PUBLIC_API_URL || 'http://localhost:5000';
const token = localStorage.getItem('token');
const response = await fetch(`${apiUrl}/admin/config`, {
headers: {

View File

@@ -82,7 +82,7 @@ docker-compose up -d
<li>Create another app: <code>goodrepo-frontend</code></li>
<li>Follow the same deployment process</li>
<li>Captain Definition File: <code>frontend/captain-definition</code></li>
<li>Set environment variable: <code>API_URL</code> = <code>https://goodrepo-backend.your-domain.com</code></li>
<li>Set environment variable: <code>NEXT_PUBLIC_API_URL</code> = <code>https://goodrepo-backend.your-domain.com</code></li>
</ol>
<h3>Step 5: Enable HTTPS</h3>

View File

@@ -24,7 +24,7 @@ export default function LoginPage() {
setLoading(true);
try {
const apiUrl = process.env.API_URL || 'http://localhost:5000';
const apiUrl = process.env.NEXT_PUBLIC_API_URL || 'http://localhost:5000';
const response = await fetch(`${apiUrl}/auth/login`, {
method: 'POST',
headers: {

View File

@@ -27,7 +27,7 @@ export default function PublishPage() {
setStatus({ type: null, message: '' });
try {
const apiUrl = process.env.API_URL || 'http://localhost:5000';
const apiUrl = process.env.NEXT_PUBLIC_API_URL || 'http://localhost:5000';
const url = `${apiUrl}/v1/${formData.namespace}/${formData.name}/${formData.version}/${formData.variant}/blob`;
const response = await fetch(url, {