diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..9e30320 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,12 @@ +.eslintignore +.eslintrc.cjs +.git +.github +.gitignore +.husky +babel.config.ts +jest.config.ts +tailwind.config.ts +tsconfig.json +tsconfig.node.json +vite.config.ts \ No newline at end of file diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 52246e0..057888c 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -6,6 +6,10 @@ on: pull_request: branches: - "**" +env: + IMAGE_NAME: messaging_app + # REPO_NAME: + jobs: build: runs-on: ubuntu-latest @@ -18,3 +22,10 @@ jobs: - run: npm install - run: npm run lint - run: npm run test + - name: Build docker image + run: | + docker build . -t $IMAGE_NAME + - name: Run docker container + run: | + docker run -d -e 5173:5173 -host=172.17.0.2 $IMAGE_NAME:latest && \ + docker ps && sleep 5 \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..814dd2a --- /dev/null +++ b/Dockerfile @@ -0,0 +1,6 @@ +FROM node:20 +WORKDIR /app +COPY package.json ./ +RUN npm install +COPY . . +CMD ["npm", "run", "dev"] \ No newline at end of file diff --git a/README.md b/README.md index 0d6babe..0ad29ab 100644 --- a/README.md +++ b/README.md @@ -28,3 +28,17 @@ export default { - Replace `plugin:@typescript-eslint/recommended` to `plugin:@typescript-eslint/recommended-type-checked` or `plugin:@typescript-eslint/strict-type-checked` - Optionally add `plugin:@typescript-eslint/stylistic-type-checked` - Install [eslint-plugin-react](https://github.com/jsx-eslint/eslint-plugin-react) and add `plugin:react/recommended` & `plugin:react/jsx-runtime` to the `extends` list + +## Run Application +```npm run dev``` +## Run Unit Tests +```npm run test``` +## Run Lint +```npm run lint``` +## Using Docker +### Build Docker Image +```docker build -t messagging_app .``` +### Run Docker container +```docker run -it -p 5173:5173 -host=172.17.0.2 messagging_app:latest``` +### Docker-compose +```docker-compose up``` \ No newline at end of file diff --git a/docker-compose.yaml b/docker-compose.yaml new file mode 100644 index 0000000..0b5f9b2 --- /dev/null +++ b/docker-compose.yaml @@ -0,0 +1,9 @@ +version: "3" +services: + messaging_app: + image: messaging_app + build: + context: ./ + ports: + - 5173:5173 + container_name: messaging_app \ No newline at end of file diff --git a/package.json b/package.json index d30cb45..54a861b 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "version": "0.0.0", "type": "module", "scripts": { - "dev": "vite", + "dev": "vite -d --host", "build": "tsc && vite build", "lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0", "preview": "vite preview", diff --git a/src/components/Login.tsx b/src/components/Login.tsx index 94aecca..54a9d9e 100644 --- a/src/components/Login.tsx +++ b/src/components/Login.tsx @@ -1,6 +1,7 @@ import '../index.css' import { useState } from "react"; +import React from 'react'; const Login: React.FC = () => { // const { setUser } = useContext(UserContext);