Spaces:
Paused
Paused
Added Dockerfile
Browse files- .dockerignore +1 -0
- Dockerfile +44 -0
- server/package.json +36 -36
.dockerignore
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
node_modules
|
Dockerfile
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# docker build -t hapticlink .
|
| 2 |
+
# docker run --name hapticlink -d -p 3000:3000 -e WS_SERVER_URL="ws://localhost:8080" hapticlink
|
| 3 |
+
|
| 4 |
+
# STAGE 1
|
| 5 |
+
# Build Flutter Project
|
| 6 |
+
FROM cirrusci/flutter:latest AS flutter-builder
|
| 7 |
+
|
| 8 |
+
WORKDIR /client
|
| 9 |
+
|
| 10 |
+
# Copies flutter project
|
| 11 |
+
COPY ./client /client
|
| 12 |
+
|
| 13 |
+
# Building project
|
| 14 |
+
RUN flutter pub get
|
| 15 |
+
RUN flutter build web
|
| 16 |
+
|
| 17 |
+
# STAGE 2
|
| 18 |
+
# Install Node Server
|
| 19 |
+
FROM node:20-bullseye-slim AS node-builder
|
| 20 |
+
|
| 21 |
+
WORKDIR /server
|
| 22 |
+
|
| 23 |
+
# Copy server project
|
| 24 |
+
COPY ./server /server
|
| 25 |
+
|
| 26 |
+
# Install node_modules and build project
|
| 27 |
+
RUN npm install
|
| 28 |
+
RUN npm run build
|
| 29 |
+
|
| 30 |
+
# STAGE 3
|
| 31 |
+
# Start server
|
| 32 |
+
FROM node:20-bullseye-slim
|
| 33 |
+
|
| 34 |
+
ENV PORT=3000
|
| 35 |
+
EXPOSE 3000
|
| 36 |
+
ENV NODE_ENV=production
|
| 37 |
+
|
| 38 |
+
WORKDIR /server
|
| 39 |
+
|
| 40 |
+
# Copies build files from client and server
|
| 41 |
+
COPY --from=node-builder /server /server
|
| 42 |
+
COPY --from=flutter-builder /client/build/web /client/build/web
|
| 43 |
+
|
| 44 |
+
CMD ["npm", "start"]
|
server/package.json
CHANGED
|
@@ -1,38 +1,38 @@
|
|
| 1 |
{
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
"
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
}
|
|
|
|
| 1 |
{
|
| 2 |
+
"name": "server",
|
| 3 |
+
"version": "1.0.0",
|
| 4 |
+
"description": "",
|
| 5 |
+
"main": "build/index.js",
|
| 6 |
+
"scripts": {
|
| 7 |
+
"test": "mocha -r ts-node/register 'test/**/*.spec.ts'",
|
| 8 |
+
"build": "tsc",
|
| 9 |
+
"start": "node .",
|
| 10 |
+
"dev": "nodemon src/index.ts"
|
| 11 |
+
},
|
| 12 |
+
"keywords": [],
|
| 13 |
+
"author": "",
|
| 14 |
+
"license": "ISC",
|
| 15 |
+
"devDependencies": {
|
| 16 |
+
"@types/chai": "^4.3.10",
|
| 17 |
+
"@types/express": "^4.17.21",
|
| 18 |
+
"@types/mocha": "^10.0.4",
|
| 19 |
+
"@types/node": "^20.9.1",
|
| 20 |
+
"@typescript-eslint/eslint-plugin": "^6.12.0",
|
| 21 |
+
"@typescript-eslint/parser": "^6.12.0",
|
| 22 |
+
"@types/ws": "^8.5.9",
|
| 23 |
+
"chai": "^4.3.10",
|
| 24 |
+
"eslint": "^8.54.0",
|
| 25 |
+
"mocha": "^10.2.0",
|
| 26 |
+
"nodemon": "^3.0.1",
|
| 27 |
+
"prettier": "^3.1.0",
|
| 28 |
+
"ts-node": "^10.9.1",
|
| 29 |
+
"typescript": "^5.2.2"
|
| 30 |
+
},
|
| 31 |
+
"dependencies": {
|
| 32 |
+
"base-x": "^4.0.0",
|
| 33 |
+
"express": "^4.18.2",
|
| 34 |
+
"pino": "^8.16.2",
|
| 35 |
+
"ws": "^8.14.2",
|
| 36 |
+
"zod": "^3.22.4"
|
| 37 |
+
}
|
| 38 |
}
|