|
1 | | -# Docker Container Setup - Documentation |
| 1 | +# Docker Container Setup - Simplified Documentation |
2 | 2 |
|
3 | | -This is the documentation on how to containerize and run the recode hive website while using Docker. |
| 3 | +This guide explains how to set up and run the Recode Hive website using Docker. |
4 | 4 |
|
5 | | -## Prerequesites |
| 5 | +## Prerequisites |
6 | 6 |
|
7 | | -- [Docker](https://docs.docker.com/engine/install/) installed |
8 | | -- Docker compose installed (Optional) |
| 7 | +- Install [Docker](https://docs.docker.com/engine/install/). |
| 8 | +- (Optional) Install Docker Compose for easier multi-container management. |
9 | 9 |
|
10 | 10 | ## Steps |
11 | 11 |
|
12 | | -### 1. Create a `Dockerfile` in the root directory |
| 12 | +### 1. Build and Run with Docker Compose (Recommended) |
13 | 13 |
|
14 | | -This is a text document that contains all the commands needs to build a Docker image. Basically a blue print of a docker image. |
| 14 | +Using Docker Compose simplifies the setup process. Run the following command in the project root directory: |
15 | 15 |
|
16 | | -Key instructions include <br> |
| 16 | +```bash |
| 17 | +docker-compose up --build |
| 18 | +``` |
| 19 | + |
| 20 | +This command will: |
| 21 | +- Build the Docker image. |
| 22 | +- Start the container. |
| 23 | +- Map port `3000` from the container to your local machine. |
17 | 24 |
|
18 | | -- `FROM <base_image>:<tag>` : The first instruction and specifies the base image to build upon. |
19 | | -- `WORKDIR <path>` : Sets the working directory inside the container for subsequent instructions. |
20 | | -- `COPY <source> <destination>` : This instruction copies files or directories from your local machine (the build context) into the Docker image. |
21 | | -- `RUN <command>` : Executes commands during the image build process. This is used for installing dependencies, updating packages etc. |
22 | | -- `EXPOSE <port>` : Informs docker that the container listens on the specified ports at runtime. |
| 25 | +Visit [http://localhost:3000](http://localhost:3000) to view the site. |
23 | 26 |
|
24 | | -### 2. Build the Docker Image |
| 27 | +### 2. Manual Setup with Docker (Optional) |
25 | 28 |
|
| 29 | +If you prefer not to use Docker Compose, follow these steps: |
| 30 | + |
| 31 | +#### a. Build the Docker Image |
26 | 32 | ```bash |
27 | 33 | docker build -t recodehive-app . |
28 | 34 | ``` |
29 | 35 |
|
30 | | -This command builds the Docker image using the instructions in the Dockerfile and tags it as recodehive-app. |
31 | | - |
32 | | -### 3. Run the Container |
33 | | - |
| 36 | +#### b. Run the Docker Container |
34 | 37 | ```bash |
35 | 38 | docker run -p 3000:3000 recodehive-app |
36 | 39 | ``` |
37 | 40 |
|
38 | | -This runs the container and maps port 3000 from the container to your local machine. <br> |
39 | | -Now Visit http://localhost:3000 to view the site. |
| 41 | +Visit [http://localhost:3000](http://localhost:3000) to view the site. |
| 42 | + |
| 43 | +## Notes |
| 44 | + |
| 45 | +- Ensure the `Dockerfile` and `docker-compose.yml` are correctly configured. |
| 46 | +- The application is set to bind to `0.0.0.0` for external access. |
| 47 | +- Use `docker logs <container_id>` to debug any issues. |
| 48 | + |
| 49 | +For more details, refer to the official Docker documentation. |
40 | 50 |
|
0 commit comments