Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitc78d4f9

Browse files
author
tsv2013
committed
Initial commit - docker up
0 parents  commitc78d4f9

37 files changed

+9654
-0
lines changed

‎.gitignore‎

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# Logs
2+
logs
3+
*.log
4+
npm-debug.log*
5+
yarn-debug.log*
6+
yarn-error.log*
7+
8+
# Runtime data
9+
pids
10+
*.pid
11+
*.seed
12+
*.pid.lock
13+
14+
# Directory for instrumented libs generated by jscoverage/JSCover
15+
lib-cov
16+
17+
# Coverage directory used by tools like istanbul
18+
coverage
19+
20+
# nyc test coverage
21+
.nyc_output
22+
23+
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
24+
.grunt
25+
26+
# Bower dependency directory (https://bower.io/)
27+
bower_components
28+
29+
# node-waf configuration
30+
.lock-wscript
31+
32+
# Compiled binary addons (http://nodejs.org/api/addons.html)
33+
build/Release
34+
35+
# Dependency directories
36+
node_modules/
37+
jspm_packages/
38+
39+
# Typescript v1 declaration files
40+
typings/
41+
42+
# Optional npm cache directory
43+
.npm
44+
45+
# Optional eslint cache
46+
.eslintcache
47+
48+
# Optional REPL history
49+
.node_repl_history
50+
51+
# Output of 'npm pack'
52+
*.tgz
53+
54+
# Yarn Integrity file
55+
.yarn-integrity
56+
57+
# dotenv environment variables file
58+
.env
59+
60+
mongo/data

‎LICENSE‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
https://creativecommons.org/licenses/by-nc/3.0/

‎README.md‎

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#SurveyJS + NodeJS + MongoDB Demo Example
2+
3+
This demo shows how to integrate[SurveyJS](https://surveyjs.io/) components with a NodeJS backend with MongoDB database as a storage.
4+
5+
[View Demo Online](https://surveyjs-nodejs.azurewebsites.net/)
6+
7+
##Disclaimer
8+
9+
This demo must not be used as a real service as it doesn't cover such real-world survey service aspects as authentication, authorization, user management, access levels, and different security issues. These aspects are covered by backend-specific articles, forums, and documentation.
10+
11+
##Run the Application
12+
13+
Install[NodeJS](https://nodejs.org/) on your machine.
14+
Install[Docker Desktop](https://docs.docker.com/desktop/) on your machine.
15+
After that, run the following commands:
16+
17+
```bash
18+
git clone https://github.com/surveyjs/surveyjs-nodejs-mongo.git
19+
cd surveyjs-nodejs-mongo
20+
docker compose up -d
21+
```
22+
23+
Openhttp://localhost:9080 in your web browser.
24+
25+
##Client-Side App
26+
27+
The client-side part is the`surveyjs-react-client` React application. The current project includes only the application's build artifacts in the /public folder. Refer to the[surveyjs-react-client](https://github.com/surveyjs/surveyjs-react-client) repo for full code and information about the application.

‎compose.yml‎

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
version:'3'
2+
services:
3+
express-app:
4+
build:
5+
args:
6+
-NODE_ENV=development
7+
context:express-app
8+
target:development
9+
environment:
10+
-DATABASE_DB=surveyjs
11+
-DATABASE_USER=admin
12+
-DATABASE_PASSWORD=/run/secrets/db-password
13+
-DATABASE_HOST=mongo
14+
-NODE_ENV=development
15+
ports:
16+
-9080:3000
17+
secrets:
18+
-db-password
19+
volumes:
20+
-./express-app:/code/express-app
21+
-./public:/code/public
22+
networks:
23+
-surveyjs-net
24+
depends_on:
25+
-mongo
26+
mongo:
27+
build:
28+
context:mongo
29+
secrets:
30+
-db-password
31+
environment:
32+
-MONGO_INITDB_ROOT_USERNAME=admin
33+
# - MONGO_INITDB_ROOT_PASSWORD=123456
34+
-MONGO_INITDB_ROOT_PASSWORD_FILE=/run/secrets/db-password
35+
-MONGO_INITDB_DATABASE=surveyjs
36+
ports:
37+
-'27017:27017'
38+
volumes:
39+
-./mongo/entrypoint:/docker-entrypoint-initdb.d
40+
-./mongo/data:/data/db
41+
-./mongo/config:/data/configdb
42+
networks:
43+
-surveyjs-net
44+
restart:unless-stopped
45+
networks:
46+
surveyjs-net:
47+
driver:bridge
48+
secrets:
49+
db-password:
50+
file:./mongo/password.txt

‎express-app/Dockerfile‎

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# syntax=docker/dockerfile:1.4
2+
FROM node:lts AS development
3+
4+
ARG NODE_ENV=production
5+
ENV NODE_ENV $NODE_ENV
6+
7+
WORKDIR /code
8+
9+
ARG PORT=3000
10+
ENV PORT $PORT
11+
EXPOSE $PORT
12+
13+
COPY ./package.json /code/package.json
14+
# RUN npm i
15+
COPY ../package-lock.json /code/package-lock.json
16+
RUN npm ci
17+
18+
CMD ["node","express-app/index.js" ]
19+
20+
FROM development as dev-envs
21+
RUN <<EOF
22+
apt-get update
23+
apt-get install -y --no-install-recommends git
24+
EOF
25+
26+
RUN <<EOF
27+
useradd -s /bin/bash -m vscode
28+
groupadd docker
29+
usermod -aG docker vscode
30+
EOF
31+
# install Docker tools (cli, buildx, compose)
32+
COPY --from=gloursdocker/docker / /

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp