I have a config file with API URL under the path "src/config.js":
const API_URL = 'https://some-url-here.com'
export default {
API_URL: API_URL
}
And a Dockerfile:
# build stage
FROM node:9.11.1-alpine as build-stage
WORKDIR /app
COPY package*.json ./
RUN npm install
COPY . .
RUN npm run build
# production stage
FROM nginx:1.13.12-alpine as production-stage
COPY --from=build-stage /app/dist /usr/share/nginx/html
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]
How can i make that API_URL available to docker, so devops could change that url?
ENV API_URL = some_urlThen in yoursrc/config.jsfile you can access it viaprocess.env.API_URLprocess.env.API_URLand in "config/dev.env.js" i'll addmodule.exports = merge(prodEnv, { API_URL: '"https://url.com"' })