Skip to content

Commit

Permalink
dockerize app
Browse files Browse the repository at this point in the history
  • Loading branch information
nefelitav committed Feb 16, 2024
1 parent 2de180d commit 1647b3b
Show file tree
Hide file tree
Showing 7 changed files with 54 additions and 1 deletion.
12 changes: 12 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -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
11 changes: 11 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ on:
pull_request:
branches:
- "**"
env:
IMAGE_NAME: messaging_app
# REPO_NAME:

jobs:
build:
runs-on: ubuntu-latest
Expand All @@ -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
6 changes: 6 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
FROM node:20
WORKDIR /app
COPY package.json ./
RUN npm install
COPY . .
CMD ["npm", "run", "dev"]
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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```
9 changes: 9 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
version: "3"
services:
messaging_app:
image: messaging_app
build:
context: ./
ports:
- 5173:5173
container_name: messaging_app
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
1 change: 1 addition & 0 deletions src/components/Login.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import '../index.css'

import { useState } from "react";
import React from 'react';

const Login: React.FC = () => {
// const { setUser } = useContext(UserContext);
Expand Down

0 comments on commit 1647b3b

Please sign in to comment.