File tree Expand file tree Collapse file tree 6 files changed +11
-2
lines changed
Expand file tree Collapse file tree 6 files changed +11
-2
lines changed Original file line number Diff line number Diff line change 1+ VITE_API_URL = http://ubuntu-backend-1:8000/api/v0.1
Original file line number Diff line number Diff line change 1+ VITE_API_URL = http://localhost:8000/api/v0.1
Original file line number Diff line number Diff line change @@ -5,6 +5,9 @@ WORKDIR /app/client
55COPY package*.json ./
66RUN npm ci
77COPY . .
8+ # Create .env file from build arg
9+ ARG VITE_API_URL
10+ RUN echo "VITE_API_URL=${VITE_API_URL}" > .env
811RUN npm run build
912
1013# Production stage
Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ import axios from 'axios';
33const token = localStorage . getItem ( 'access_token' ) ;
44
55const axiosInstance = axios . create ( {
6- baseURL : 'http://127.0.0.1:8000/api/v0.1' ,
6+ baseURL : import . meta . env . VITE_API_URL ,
77} ) ;
88
99export default axiosInstance ;
Original file line number Diff line number Diff line change @@ -17,6 +17,10 @@ services:
1717
1818 frontend :
1919 image : ${DOCKERHUB_USERNAME:-username}/final_project_react_image:latest
20+ build :
21+ context : ./client
22+ args :
23+ - VITE_API_URL=http://13.36.171.143:8000/api/v0.1
2024 ports :
2125 - " 80:80"
2226 depends_on :
Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ WORKDIR /app
88COPY . .
99
1010# Install dependencies
11- RUN composer install --optimize-autoloader --no-dev
11+ RUN composer install --optimize-autoloader --no-dev && \ composer require fakerphp/faker --dev
1212
1313# Set permissions
1414RUN chown -R daemon:daemon /app/storage /app/bootstrap/cache
You can’t perform that action at this time.
0 commit comments