Files
react-docker-env/README.md
2024-10-16 17:48:49 -04:00

17 lines
789 B
Markdown

## Overview
This is a simple demo meant to demonstrate the process of using environment variables with Docker/React. When we build the image we pass the value of the environment variables as build arguments. You can specify as many as you need. In this example I am only using one but you can have multiple like this as well:
```shell
docker build --build-arg ARG1=test --build-arg ARG2=test .
```
## Build and run
To build and run this example you can use the below commands.
```shell
docker build -t react-docker-test --build-arg MY_VARIABLE=world .
docker run -p 3000:3000 react-docker-test
```
If everything goes well, once the application has fully started you should be able to navigate to `http://localhost:3000` in your browser and see the text "Hello world" on the screen.