Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/cslant/react-docker
This is a simple docker configuration for React. It is suitable for both development and production environments.
https://github.com/cslant/react-docker
cslant cslant-docker docker docker-compose docker-template docker-templates react-docker react-environnement reactjs
Last synced: 10 days ago
JSON representation
This is a simple docker configuration for React. It is suitable for both development and production environments.
- Host: GitHub
- URL: https://github.com/cslant/react-docker
- Owner: cslant
- Created: 2024-01-18T08:16:49.000Z (12 months ago)
- Default Branch: main
- Last Pushed: 2024-04-30T01:45:25.000Z (8 months ago)
- Last Synced: 2024-04-30T02:41:52.022Z (8 months ago)
- Topics: cslant, cslant-docker, docker, docker-compose, docker-template, docker-templates, react-docker, react-environnement, reactjs
- Language: JavaScript
- Homepage:
- Size: 185 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Docker for React
This is a simple docker configuration for React. It is suitable for both development and production environments.
## For development
First, update the **APP_CONTAINER_NAME** and **APP_PORT** variables in the .env file if you want to change the container name and the port number.
```bash
cp .env.example .env
```And change variables. Example:
```dotenv
APP_CONTAINER_NAME=react-app
APP_PORT=3001
```Then, run the following command to start the development server:
```bash
docker compose up -d
```Now, you can access the development server at http://localhost:3001.
## For production
First, update the **APP_CONTAINER_NAME** and **APP_PORT** variables in the .env file if you want to change the container name and the port number.
```bash
cp .env.example .env
```And change variables. Example:
```dotenv
APP_CONTAINER_NAME=react-app-prod
PROD_APP_PORT=85
```Then, run the following command to build the production image:
```bash
docker compose -f docker-compose.prod.yml up -d --build
```Now, you can access the production server at http://localhost:85.
> [!IMPORTANT]
> ## Note
> Every time you change the source code, you need to rebuild the image by running the above command again.