mirror of
https://github.com/johndoe6345789/goodpackagerepo.git
synced 2026-04-24 13:54:59 +00:00
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:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
/** @type {import('next').NextConfig} */
|
||||
const nextConfig = {
|
||||
env: {
|
||||
API_URL: process.env.API_URL || 'http://localhost:5000',
|
||||
},
|
||||
output: 'standalone',
|
||||
}
|
||||
|
||||
|
||||
@@ -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`, {
|
||||
|
||||
@@ -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: {
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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: {
|
||||
|
||||
@@ -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, {
|
||||
|
||||
Reference in New Issue
Block a user