Skip to content

Commit 2534de9

Browse files
committed
docs: update README to include environment variable setup and Docker instructions
1 parent 0946fd6 commit 2534de9

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed

README.md

+47
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,53 @@ With this setup, the API ensures efficient and reliable data handling and routin
4848

4949
Ensure MySQL is running and create a database for the application. Update the database credentials in the environment variables.
5050

51+
4. **Set Environment Variables:**
52+
53+
Create a `.env` file in the root directory of the project and add the following environment variables:
54+
55+
```sh
56+
DB_HOST=localhost
57+
DB_PORT=3306
58+
DB_USER=root
59+
DB_PASSWORD=yourpassword
60+
DB_NAME=yourdatabase
61+
```
62+
63+
5. **Docker Setup:**
64+
65+
This project includes Docker files to set up the entire stack easily. Ensure you have Docker installed on your machine.
66+
67+
- **Build the Docker image:**
68+
69+
```sh
70+
docker build -t rest-api .
71+
```
72+
73+
- **Run the Docker container:**
74+
75+
```sh
76+
docker run -d -p 8080:8080 --env-file .env rest-api
77+
```
78+
79+
6. **Docker Compose Setup:**
80+
81+
This project includes a `docker-compose.yml` file to set up the entire stack, including MySQL, easily. Ensure you have Docker and Docker Compose installed on your machine.
82+
83+
- **Update the `.env` file to use the MySQL container:**
84+
85+
```sh
86+
DB_HOST=db
87+
DB_PORT=3306
88+
DB_USER=root
89+
DB_PASSWORD=yourpassword
90+
DB_NAME=yourdatabase
91+
```
92+
93+
- **Start the services using Docker Compose:**
94+
95+
```sh
96+
docker-compose up -d
97+
```
5198

5299
## Running the Application
53100

0 commit comments

Comments
 (0)