This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"scripts": { | |
"dev": "chmod +x ./env.sh && ./env.sh && mv env-config.js ./public/env-config.js && react-scripts start", | |
"test": "react-scripts test", | |
"eject": "react-scripts eject", | |
"build": "sh -ac '. ./.env; react-scripts build'" | |
}, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# => Build container | |
FROM node:alpine as builder | |
WORKDIR /app | |
COPY package.json . | |
COPY yarn.lock . | |
RUN yarn | |
COPY . . | |
RUN yarn build | |
# => Run container |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<p>API_URL: {window._env_.API_URL}</p> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
API_URL=https://my.new.dev.api.com yarn dev |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Temporary env files | |
/public/env-config.js | |
env-config.js |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
docker build . -t kunokdev/cra-runtime-environment-variables | |
docker run -p 3000:80 -e API_URL=https://staging.api.com -t kunokdev/cra-runtime-environment-variables | |
docker push -t kunokdev/cra-runtime-environment-variables |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: "3.2" | |
services: | |
gateway-proxy: | |
image: kunokdev/gateway-proxy:${TAG:-latest} | |
restart: always | |
ports: | |
- "5000:80" | |
networks: | |
- private-network |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: "3.2" | |
services: | |
item-service: | |
volumes: | |
- "./item-service:/app" | |
command: ["yarn", "dev"] | |
build: | |
context: "./item-service" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Create project root directory | |
mkdir docker-compose-development-environment && cd "$_" | |
# Create service directories | |
mkdir gateway-proxy item-service inventory-service user-service | |
# Create docker-compose files | |
touch docker-compose.yml docker-compose.develop.yml | |
# Initialize git |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"scripts": { | |
"start": "node main.js", | |
"dev": "nodemon main.js" | |
}, |