- 1. Prerequisites
- 2. Installation
- 3. Running the Application
- 4. Environment Configuration
- 5. Prerequisites to run the Application in Docker
- 6. Build the Docker image using the provided Dockerfile
- 7. Run the Application
- 8. Accessing the Application
- 9. Stopping and Cleaning Up
Before running the application, make sure you have the following dependencies installed:
- Node.js: Download and Install Node.js
- npm (Node Package Manager): It comes with Node.js, so no need to install separately.
Clone the repository and install project dependencies.
git clone https://github.com/katelovestocode/frontend-internship.git
cd your-project-directory
npm install
Start your Next.js application on port 3000 using the following command:
npm run dev
To configure your Next.js application, you will need an environment (.env) file. This file is used to store sensitive data and configuration settings. Here's how you can set up your .env file:
-
Create an
.envfile in the root of your project directory. -
Define your environment variables in the
.envfile. You need to specify values for variables like PORT, Database connection URLs, API keys, and other configuration settings. For example:PORT=3000
Before you can run the application in Docker, make sure you have the following dependencies installed on your machine:
- Docker: Download and install Docker from https://www.docker.com/get-started.
docker build -t docker-frontend --progress=plain --no-cache --target prod .
Now that you have built the Docker image, you can run the application within a Docker container. Use the following command:
docker run -d -p 3000:3000 --name docker-frontend docker-frontend
Once the container is up and running, you can access the application in your web browser by navigating to:
http://localhost:3000
To stop the Docker container, use the following command:
docker stop docker-frontend
To remove the Docker container and image when you're done, run:
docker rm docker-frontend
docker rmi docker-frontend