diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..cb25382 --- /dev/null +++ b/.dockerignore @@ -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 \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..a471efc --- /dev/null +++ b/Dockerfile @@ -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"] \ No newline at end of file diff --git a/README.md b/README.md index cec6ce7..cea936c 100644 --- a/README.md +++ b/README.md @@ -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 +``` + +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)