Skip to content

Add Docker Support for Seamless Deployment and Development #78

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
node_modules
dist
.env
.env.local
.env.development.local
.env.test.local
.env.production.local
npm-debug.log*
yarn-debug.log*
build
16 changes: 16 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
FROM node:18

WORKDIR /app

COPY package*.json ./

RUN npm install

COPY . .

RUN npm run build


EXPOSE 3000

CMD ["npm", "start"]
61 changes: 61 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,67 @@ npm run build

This command bundles React in production mode and optimizes the build for the best performance. The build is minified, and the filenames include hashes. Once the build process is complete, your app is ready to be deployed.

## Docker Setup

This project is Dockerized to ensure seamless development and deployment. Follow the instructions below to build, run, and stop the Docker container.

### Prerequisites

- [Docker](https://www.docker.com/get-started) should be installed on your system.

### Building the Docker Image

To build the Docker image for this application, navigate to the root of the project (where the Dockerfile is located) and run the following command:

```bash
docker buildx build -t your-app .
```

- **`-t your-app`**: This tags the image with the name `your-app`.
- **`.`**: Refers to the current directory where the Dockerfile and project files are located.

### Running the Docker Container

Once the image is built, you can run the Docker container with the following command:

```bash
docker run -p 3000:3000 your-app
```

- **`-p 3000:3000`**: Maps port 3000 inside the container to port 3000 on your local machine, allowing you to access the app via `http://localhost:3000`.
- **`your-app`**: The name of the Docker image you built.

### Stopping the Docker Container

To stop the running Docker container, first find the container ID or name by running:

```bash
docker ps
```

This will list all running containers. Use the container ID or name in the following command to stop the container:

```bash
docker stop <container_id_or_name>
```

For example:

```bash
docker stop abc123
```


## Notes

- Ensure that you have Docker running before executing these commands.
- If you change the source code, you may need to rebuild the Docker image using the `docker buildx build` command.


### Customization Notes:
- Replace `your-app` with your desired image name.
- Make sure to provide instructions to install Docker if your users might not have it installed.

# Contributing

- To contribute to ACM FUN, refer to [Contributing Guidlines](./Contributing.md)
Expand Down