feat: added dockerfile

This commit is contained in:
Sergey Yarkov 2022-03-29 23:43:24 +03:00
parent 2f0cf13a40
commit 4e72abee41
6 changed files with 44 additions and 2 deletions

15
.dockerignore Normal file
View File

@ -0,0 +1,15 @@
node_modules
dist
dist-ssr
coverage
stats.html
Dockerfile*
docker-compose*
.dockerignore
*.md
*.local
.git
.gitignore
.vscode
.DS_STORE
.env

18
Dockerfile Normal file
View File

@ -0,0 +1,18 @@
ARG NODE_IMAGE=node:14.17.3-alpine3.11
ARG NGINX_IMAGE=nginx:1.16.0-alpine
FROM ${NODE_IMAGE} as builder
WORKDIR /home/app
COPY package*.json ./
RUN npm install
COPY . .
RUN npm run build
FROM ${NGINX_IMAGE} as production
WORKDIR /usr/share/nginx/html
RUN rm /etc/nginx/conf.d/default.conf
COPY --from=builder /home/app/dist /usr/share/nginx/html
COPY ./nginx/default.conf /etc/nginx/conf.d/default.conf
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]

8
nginx/default.conf Normal file
View File

@ -0,0 +1,8 @@
server {
listen 80;
location / {
root /usr/share/nginx/html;
index index.html index.htm;
try_files $uri $uri/ /index.html =404;
}
}

View File

@ -3,7 +3,7 @@
"version": "1.0.0",
"scripts": {
"dev": "vite",
"build": "tsc && vite build",
"build": "vite build",
"serve": "vite preview",
"format": "prettier --write \"src/**/*.{js,jsx,ts,tsx}\"",
"lint": "prettier --check \"src/**/*.{js,jsx,ts,tsx}\""

View File

@ -3,7 +3,7 @@ import { ChatButton } from './ChatButton';
export interface IAvatarProps {
name: string;
isOnline?: boolean | undefined;
isOnline?: boolean | null;
}
export interface IChatButtonProps {

View File

@ -20,6 +20,7 @@ export default defineConfig({
publicDir: 'public',
plugins: [react()],
server: {
port: 5000,
proxy: {
'/api': {
target: constants.BACKEND_URL,