From 2bb64fd54ec03423518be125d58f11b311a39039 Mon Sep 17 00:00:00 2001 From: abhishandy Date: Sat, 23 Sep 2023 07:07:23 -0400 Subject: [PATCH] ci: dockerize #122 --- .dockerignore | 2 ++ Dockerfile | 17 +++++++++++++++++ README.md | 26 +++++++++----------------- 3 files changed, 28 insertions(+), 17 deletions(-) create mode 100644 .dockerignore create mode 100644 Dockerfile diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 00000000..b90a368f --- /dev/null +++ b/.dockerignore @@ -0,0 +1,2 @@ +node_modules +.next diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..a6d39514 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,17 @@ +FROM node:18-alpine + +WORKDIR /frontend + +COPY package.json ./ + +COPY yarn.lock ./ + +RUN yarn install + +COPY . . + +RUN yarn build + +EXPOSE 3000 + +CMD yarn start \ No newline at end of file diff --git a/README.md b/README.md index 919334b9..0a4e115e 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,5 @@ # Documentation of the WiiQare Project -[![Deploy to AWS](https://github.com/WiiQare/frontend/actions/workflows/main.yml/badge.svg)](https://github.com/WiiQare/frontend/actions/workflows/main.yml) [![codecov](https://codecov.io/gh/WiiQare/frontend/branch/main/graph/badge.svg?token=72SLV6EFSP)](https://codecov.io/gh/WiiQare/frontend) [![Tests](https://github.com/WiiQare/frontend/actions/workflows/jest.js.yml/badge.svg)](https://github.com/WiiQare/frontend/actions/workflows/jest.js.yml) @@ -25,35 +24,28 @@ To install and run this Next.js project locally, follow the steps below: 1. Clone the GitHub repository to your local machine using the following command: ```shell - git clone https://github.com/WiiQare/frontend.git "frontend-wiiQare" + git clone https://github.com/WiiQare/frontend.git ``` 2. Navigate to the project directory : ```shell - cd frontend-wiiQare + cd frontend ``` -3. Install dependencies using npm or yarn: +3. Build Docker image - ```shell - npm install - - or - - - yarn install + ```sh + docker build -t frontend . ``` -4. Configure necessary environment variables, such as API keys, base URLs, etc., in a `.env` file in the root of the project. - -5. Launch the application in development mode: +4. Run Docker image - ```shell - npm run dev + ```sh + docker run -p 3000:3000 frontend ``` - The application will be accessible at the following address : `http://localhost:3000`. +5. Open `http://localhost:3000` in your favorite browser ## Project structure