Преглед на файлове

Add build args to Dockerfile and fix enviroment naming

Francesco Silvetti преди 4 години
родител
ревизия
341529d62f
променени са 2 файла, в които са добавени 3 реда и са изтрити 1 реда
  1. 2 0
      Dockerfile.production
  2. 1 1
      app/src/config/index.ts

+ 2 - 0
Dockerfile.production

@@ -4,6 +4,7 @@
 # Esto para que la imagen sea más liviana y no incluya nada más que el build de producción y nginx
 
 FROM node:14-alpine AS builder
+ARG REACT_APP_API_URL
 ENV NODE_ENV production
 # Add a work directory
 WORKDIR /app
@@ -14,6 +15,7 @@ RUN npm install --production
 # Copy app files
 COPY ./app .
 # Build the app
+ENV REACT_APP_API_URL=${REACT_APP_API_URL}
 RUN npm run build
 
 # Bundle static assets with nginx

+ 1 - 1
app/src/config/index.ts

@@ -1,4 +1,4 @@
-export const apiURL = process.env.API_URL || "http://localhost:8000/v1/";
+export const apiURL = process.env.REACT_APP_API_URL || "http://localhost:8000/v1/";
 
 export default {
   apiURL,