Skip to content

Commit 827f65b

Browse files
Danil VikulovDanil Vikulov
authored andcommitted
containerized by docker
1 parent 6221344 commit 827f65b

6 files changed

Lines changed: 62 additions & 2 deletions

File tree

demo/.dockerignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
node_modules
2+
logs
3+
Dockerfile
4+
.dockerignore
5+
package-lock.json
6+
ecosystem.config.cjs

demo/Dockerfile

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# --- build stage ---
2+
FROM node:20-alpine AS builder
3+
4+
WORKDIR /app
5+
6+
COPY package*.json ./
7+
RUN npm install
8+
9+
COPY . .
10+
11+
RUN npm run build
12+
13+
14+
# --- production stage ---
15+
FROM node:20-alpine
16+
17+
WORKDIR /app
18+
19+
COPY package*.json ./
20+
RUN npm install --omit=dev
21+
22+
COPY --from=builder /app/dist ./dist
23+
24+
EXPOSE 3000
25+
26+
CMD ["node", "dist/server.js"]

demo/compose.yaml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
services:
2+
app:
3+
build: .
4+
ports:
5+
- "3000:3000"
6+
environment:
7+
- NODE_ENV=production
8+
- PORT=3000
9+
- MAIN_ADDRESS=https://dropzone.deevee.ru
10+
- SITE_TITLE=React Basic Dropzone Library Demo
11+
restart: unless-stopped
12+
healthcheck:
13+
test: ["CMD", "node", "-e", "const req=require('http').get('http://localhost:3000',res=>process.exit(res.statusCode===200?0:1));req.on('error',()=>process.exit(1));"]
14+
start_period: 30s
15+
interval: 60s
16+
timeout: 10s
17+
retries: 3

demo/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@
33
"private": false,
44
"license": "MIT",
55
"scripts": {
6-
"build": "npm run build:client && npm run build:server",
6+
"build": "npm run build:client && npm run build:server && npm run build:node",
77
"build:client": "vite build --ssrManifest --outDir dist/client",
88
"build:server": "vite build --ssr src/app/entry-server.tsx --outDir dist/server",
9+
"build:node": "tsc -p tsconfig.server.json",
910
"start": "cross-env NODE_ENV=production node ./server.ts",
1011
"lint": "eslint src/**/*.{js,jsx,ts,tsx}"
1112
},

demo/src/pages/main/main.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ const Main = () => {
6363
return (
6464
<div className="content">
6565
<div className="w-full">
66-
<h1 className="text-4xl font-bold text-hermgreen-800 text-center">React Dropzone Library</h1>
66+
<h1 className="text-4xl font-bold text-fruitgreen-800 text-center">React Dropzone Library</h1>
6767
<div className="w-lg mx-auto">
6868
<Dropzone
6969
upload={upload}

demo/tsconfig.server.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"compilerOptions": {
3+
"outDir": "dist",
4+
"module": "ESNext",
5+
"target": "ES2020",
6+
"moduleResolution": "bundler",
7+
"esModuleInterop": true
8+
},
9+
"include": ["server.ts"]
10+
}

0 commit comments

Comments
 (0)