add env var
This commit is contained in:
@@ -4,6 +4,11 @@ FROM node:18-alpine as builder
|
||||
# Set the working directory in the container
|
||||
WORKDIR /usr/src/app
|
||||
|
||||
# Define the build-time argument
|
||||
ARG REACT_APP_BACKEND_URL
|
||||
# Set the environment variable for the build process
|
||||
ENV REACT_APP_BACKEND_URL=$REACT_APP_BACKEND_URL
|
||||
|
||||
# Copy package.json and package-lock.json to the working directory
|
||||
COPY package*.json ./
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import axios from 'axios';
|
||||
|
||||
const API_URL = 'http://localhost:3001/api';
|
||||
const BACKEND_URL = process.env.REACT_APP_BACKEND_URL || 'http://localhost:3001';
|
||||
const API_URL = `${BACKEND_URL}/api`;
|
||||
|
||||
export async function getServices() {
|
||||
const response = await axios.get(`${API_URL}/services`);
|
||||
|
||||
Reference in New Issue
Block a user